mirror of
https://github.com/FlipsideCrypto/sei-models.git
synced 2026-02-06 15:36:45 +00:00
tests
This commit is contained in:
parent
5c7f2e2b46
commit
4037dcef54
6
models/descriptions/action.md
Normal file
6
models/descriptions/action.md
Normal file
@ -0,0 +1,6 @@
|
||||
{% docs action %}
|
||||
|
||||
|
||||
The action taken in the msg group. For staking this includes delegate, undelegate, redelegate, withdraw_rewards.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/chain_id.md
Normal file
5
models/descriptions/chain_id.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs chain_id %}
|
||||
|
||||
The name and version of the blockchain
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/completion_time.md
Normal file
5
models/descriptions/completion_time.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs completion_time %}
|
||||
|
||||
The time at which the undelegate or redelegate staking action is completed.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/depositor.md
Normal file
5
models/descriptions/depositor.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs depositor %}
|
||||
|
||||
The wallet address of the individual who deposited funds into the proposal
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/msg_index.md
Normal file
5
models/descriptions/msg_index.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs msg_index %}
|
||||
|
||||
Short for "message index," the position in which messages occur in a transaction.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/msg_sub_group.md
Normal file
5
models/descriptions/msg_sub_group.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs msg_sub_group %}
|
||||
|
||||
Silver only -- Numeric value grouping different messages together to represent a single action within a group. This is relevent for exec actions that contain mutiple underlying actions. NULL sub group means messages are related to the header (overall transaction)
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/msg_type.md
Normal file
5
models/descriptions/msg_type.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs msg_type %}
|
||||
|
||||
A string containing information about the type of message occurring.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/proposal_description.md
Normal file
5
models/descriptions/proposal_description.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs proposal_description %}
|
||||
|
||||
The description or body of the governance proposal.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/proposal_id.md
Normal file
5
models/descriptions/proposal_id.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs proposal_id %}
|
||||
|
||||
Numeric ID that corresponds to the proposal.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/proposal_title.md
Normal file
5
models/descriptions/proposal_title.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs proposal_title %}
|
||||
|
||||
The title of the governance proposal that was submitted on-chain.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/proposal_type.md
Normal file
5
models/descriptions/proposal_type.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs proposal_type %}
|
||||
|
||||
The type of proposal that was submitted.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/proposer.md
Normal file
5
models/descriptions/proposer.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs proposer %}
|
||||
|
||||
The address of the validator that submitted the proposal.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/proposer_address.md
Normal file
5
models/descriptions/proposer_address.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs proposer_address %}
|
||||
|
||||
The address of the validator that proposed the block.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/receiver.md
Normal file
5
models/descriptions/receiver.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs receiver %}
|
||||
|
||||
The wallet address of the individual received tokens in the transfer.
|
||||
|
||||
{% enddocs %}
|
||||
@ -0,0 +1,5 @@
|
||||
{% docs redelegate_source_validator_address %}
|
||||
|
||||
The wallet address of the source alidator in a redelegation staking action.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/sender.md
Normal file
5
models/descriptions/sender.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs sender %}
|
||||
|
||||
The wallet address of the individual sent tokens in the transfer.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/transfer_type.md
Normal file
5
models/descriptions/transfer_type.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs transfer_type %}
|
||||
|
||||
Details on the type of transfer occurring during the transaction. "IBC_Transfer_In" = depositing tokens onto Sei. "IBC_transfer_out" = withdrawing tokens from Sei. "Sei" = wallet to wallet transfer on Sei.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/tx_count.md
Normal file
5
models/descriptions/tx_count.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs tx_count %}
|
||||
|
||||
The number of transactions that occurred during a block.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/validator_hash.md
Normal file
5
models/descriptions/validator_hash.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs validator_hash %}
|
||||
|
||||
The root hash of the new validator set.
|
||||
|
||||
{% enddocs %}
|
||||
66
models/silver/silver__blocks.yml
Normal file
66
models/silver/silver__blocks.yml
Normal file
@ -0,0 +1,66 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: silver__blocks
|
||||
description: Records of all blocks that have occurred on Sei, dating back to the genesis block.
|
||||
tests:
|
||||
- dbt_utils.unique_combination_of_columns:
|
||||
combination_of_columns:
|
||||
- CHAIN_ID
|
||||
- BLOCK_ID
|
||||
columns:
|
||||
- name: BLOCK_ID
|
||||
description: "{{ doc('block_id') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- NUMBER
|
||||
- name: BLOCK_TIMESTAMP
|
||||
description: "{{ doc('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
|
||||
- name: CHAIN_ID
|
||||
description: "{{ doc('chain_id') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
- name: TX_COUNT
|
||||
description: "{{ doc('tx_count') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- NUMBER
|
||||
- FLOAT
|
||||
- name: PROPOSER_ADDRESS
|
||||
description: "{{ doc('proposer_address') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
- name: VALIDATOR_HASH
|
||||
description: "{{ doc('validator_hash') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
- name: _INSERTED_TIMESTAMP
|
||||
description: "{{ doc('inserted_timestamp') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- TIMESTAMP_NTZ
|
||||
@ -109,7 +109,7 @@ SELECT
|
||||
tx_succeeded,
|
||||
d.depositor,
|
||||
p.proposal_id :: NUMBER AS proposal_id,
|
||||
v.amount,
|
||||
v.amount :: FLOAT AS amount,
|
||||
v.currency,
|
||||
_inserted_timestamp
|
||||
FROM
|
||||
|
||||
79
models/silver/silver__governance_proposal_deposits.yml
Normal file
79
models/silver/silver__governance_proposal_deposits.yml
Normal file
@ -0,0 +1,79 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: silver__governance_proposal_deposits
|
||||
description: Records of all proposal deposits that have occurred on Sei, dating back to the genesis block
|
||||
tests:
|
||||
- dbt_utils.unique_combination_of_columns:
|
||||
combination_of_columns:
|
||||
- TX_ID
|
||||
columns:
|
||||
- name: BLOCK_ID
|
||||
description: "{{ doc('block_id') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- NUMBER
|
||||
- FLOAT
|
||||
- name: BLOCK_TIMESTAMP
|
||||
description: "{{ doc('block_timestamp') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- TIMESTAMP_NTZ
|
||||
- name: TX_ID
|
||||
description: "{{ doc('tx_id') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
- name: TX_SUCCEEDED
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- BOOLEAN
|
||||
- name: DEPOSITOR
|
||||
description: "{{ doc('depositor') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
- dbt_expectations.expect_column_values_to_match_regex:
|
||||
regex: sei1[0-9a-z]{38,38}
|
||||
- name: PROPOSAL_ID
|
||||
description: "{{ doc('proposal_id') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- NUMBER
|
||||
- FLOAT
|
||||
- name: AMOUNT
|
||||
description: "{{ doc('amount') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- NUMBER
|
||||
- FLOAT
|
||||
- name: CURRENCY
|
||||
description: "{{ doc('currency') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
- name: _INSERTED_TIMESTAMP
|
||||
description: "{{ doc('inserted_timestamp') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- TIMESTAMP_NTZ
|
||||
@ -101,6 +101,8 @@ SELECT
|
||||
proposer,
|
||||
p.proposal_id :: NUMBER AS proposal_id,
|
||||
y.proposal_type,
|
||||
NULL AS proposal_title,
|
||||
NULL AS proposal_description,
|
||||
{# COALESCE(
|
||||
tx_body :messages [0] :content :title,
|
||||
tx_body :messages [0] :msgs [0] :content :title
|
||||
|
||||
87
models/silver/silver__governance_submit_proposal.yml
Normal file
87
models/silver/silver__governance_submit_proposal.yml
Normal file
@ -0,0 +1,87 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: silver__governance_submit_proposal
|
||||
description: Records of all proposal submissions on Sei, dating back to the genesis block.
|
||||
tests:
|
||||
- dbt_utils.unique_combination_of_columns:
|
||||
combination_of_columns:
|
||||
- TX_ID
|
||||
columns:
|
||||
- name: BLOCK_ID
|
||||
description: "{{ doc('block_id') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- NUMBER
|
||||
- FLOAT
|
||||
- name: BLOCK_TIMESTAMP
|
||||
description: "{{ doc('block_timestamp') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- TIMESTAMP_NTZ
|
||||
- name: TX_ID
|
||||
description: "{{ doc('tx_id') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
- name: TX_SUCCEEDED
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- BOOLEAN
|
||||
- name: PROPOSER
|
||||
description: "{{ doc('proposer') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
- dbt_expectations.expect_column_values_to_match_regex:
|
||||
regex: sei1[0-9a-z]{38,38}
|
||||
- name: PROPOSAL_ID
|
||||
description: "{{ doc('proposal_id') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- NUMBER
|
||||
- FLOAT
|
||||
- name: PROPOSAL_TYPE
|
||||
description: "{{ doc('proposal_type') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
- name: PROPOSAL_TITLE
|
||||
description: "{{ doc('proposal_title') }}"
|
||||
tests:
|
||||
# - not_null --pending tx body
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
- name: PROPOSAL_DESCRIPTION
|
||||
description: "{{ doc('proposal_description') }}"
|
||||
tests:
|
||||
# - not_null --pending tx body
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
- name: _INSERTED_TIMESTAMP
|
||||
description: "{{ doc('inserted_timestamp') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- TIMESTAMP_NTZ
|
||||
96
models/silver/silver__msg_attributes.yml
Normal file
96
models/silver/silver__msg_attributes.yml
Normal file
@ -0,0 +1,96 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: silver__msg_attributes
|
||||
description: Records of all message attributes associated to messages that have occurred on Sei, dating back to the genesis block.
|
||||
tests:
|
||||
- dbt_utils.unique_combination_of_columns:
|
||||
combination_of_columns:
|
||||
- TX_ID
|
||||
- MSG_INDEX
|
||||
- ATTRIBUTE_INDEX
|
||||
columns:
|
||||
- name: BLOCK_ID
|
||||
description: "{{ doc('block_id') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- NUMBER
|
||||
- FLOAT
|
||||
- name: BLOCK_TIMESTAMP
|
||||
description: "{{ doc('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
|
||||
- name: TX_ID
|
||||
description: "{{ doc('tx_id') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
- name: TX_SUCCEEDED
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- BOOLEAN
|
||||
- name: MSG_GROUP
|
||||
description: "{{ doc('msg_group') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- NUMBER
|
||||
- FLOAT
|
||||
- name: MSG_SUB_GROUP
|
||||
description: "{{ doc('msg_sub_group') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- NUMBER
|
||||
- FLOAT
|
||||
- name: MSG_INDEX
|
||||
description: "{{ doc('msg_index') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- NUMBER
|
||||
- FLOAT
|
||||
- name: MSG_TYPE
|
||||
description: "{{ doc('msg_type') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
- name: _INSERTED_TIMESTAMP
|
||||
description: "{{ doc('inserted_timestamp') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- TIMESTAMP_NTZ
|
||||
- name: ATTRIBUTE_KEY
|
||||
description: "They key from the key-value pair from the message attribute"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
- name: ATTRIBUTE_VALUE
|
||||
description: "They value from the key-value pair from the message attribute"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
|
||||
77
models/silver/silver__msgs.yml
Normal file
77
models/silver/silver__msgs.yml
Normal file
@ -0,0 +1,77 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: silver__msgs
|
||||
description: Records of all messages associated to transactions that have occurred on Sei, dating back to the genesis block.
|
||||
tests:
|
||||
- dbt_utils.unique_combination_of_columns:
|
||||
combination_of_columns:
|
||||
- TX_ID
|
||||
- MSG_INDEX
|
||||
columns:
|
||||
- name: BLOCK_ID
|
||||
description: "{{ doc('block_id') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- NUMBER
|
||||
- FLOAT
|
||||
- name: BLOCK_TIMESTAMP
|
||||
description: "{{ doc('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
|
||||
- name: TX_ID
|
||||
description: "{{ doc('tx_id') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- name: TX_SUCCEEDED
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- BOOLEAN
|
||||
- name: MSG_GROUP
|
||||
description: "{{ doc('msg_group') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- NUMBER
|
||||
- FLOAT
|
||||
- name: MSG_SUB_GROUP
|
||||
description: "{{ doc('msg_sub_group') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- NUMBER
|
||||
- FLOAT
|
||||
- name: MSG_INDEX
|
||||
description: "{{ doc('msg_index') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- NUMBER
|
||||
- FLOAT
|
||||
- name: MSG_TYPE
|
||||
description: "{{ doc('msg_type') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
- name: MSG
|
||||
description: "The underlying json from the message or event within the transactions"
|
||||
- name: _INSERTED_TIMESTAMP
|
||||
description: "{{ doc('inserted_timestamp') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- TIMESTAMP_NTZ
|
||||
137
models/silver/silver__staking.yml
Normal file
137
models/silver/silver__staking.yml
Normal file
@ -0,0 +1,137 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: silver__staking
|
||||
description: Records of all staking related transactions that have occurred on Sei, dating back to the genesis block. These actions include delegate, undelegate, and redelegate.
|
||||
tests:
|
||||
- dbt_utils.unique_combination_of_columns:
|
||||
combination_of_columns:
|
||||
- TX_ID
|
||||
- MSG_GROUP
|
||||
- MSG_SUB_GROUP
|
||||
- ACTION
|
||||
- CURRENCY
|
||||
- DELEGATOR_ADDRESS
|
||||
- VALIDATOR_ADDRESS
|
||||
columns:
|
||||
- name: BLOCK_ID
|
||||
description: "{{ doc('block_id') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- NUMBER
|
||||
- FLOAT
|
||||
- name: BLOCK_TIMESTAMP
|
||||
description: "{{ doc('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
|
||||
- name: TX_ID
|
||||
description: "{{ doc('tx_id') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
- name: TX_SUCCEEDED
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- BOOLEAN
|
||||
- name: TX_CALLER_ADDRESS
|
||||
description: "{{ doc('tx_caller_address') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
- dbt_expectations.expect_column_values_to_match_regex:
|
||||
regex: sei1[0-9a-z]{38,38}
|
||||
- name: ACTION
|
||||
description: "{{ doc('action') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
- name: MSG_GROUP
|
||||
description: "{{ doc('msg_group') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- NUMBER
|
||||
- FLOAT
|
||||
- name: MSG_SUB_GROUP
|
||||
description: "{{ doc('msg_sub_group') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- NUMBER
|
||||
- FLOAT
|
||||
- name: DELEGATOR_ADDRESS
|
||||
description: "{{ doc('delegator_address') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
- dbt_expectations.expect_column_values_to_match_regex:
|
||||
regex: sei1[0-9a-z]{38,38}
|
||||
- name: AMOUNT
|
||||
description: "{{ doc('amount') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- NUMBER
|
||||
- FLOAT
|
||||
- name: CURRENCY
|
||||
description: "{{ doc('currency') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
- name: VALIDATOR_ADDRESS
|
||||
description: "{{ doc('validator_address') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
- dbt_expectations.expect_column_values_to_match_regex:
|
||||
regex: seivaloper1[0-9a-z]{38,38}
|
||||
- name: REDELEGATE_SOURCE_VALIDATOR_ADDRESS
|
||||
description: "{{ doc('redelegate_source_validator_address') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
- dbt_expectations.expect_column_values_to_match_regex:
|
||||
regex: seivaloper1[0-9a-z]{38,38}
|
||||
- name: COMPLETION_TIME
|
||||
description: "{{ doc('completion_time') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- TIMESTAMP_NTZ
|
||||
- name: _INSERTED_TIMESTAMP
|
||||
description: "{{ doc('inserted_timestamp') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- TIMESTAMP_NTZ
|
||||
@ -4,10 +4,8 @@
|
||||
incremental_strategy = 'merge',
|
||||
cluster_by = ['block_timestamp::DATE'],
|
||||
) }}
|
||||
|
||||
select 1 a
|
||||
{#
|
||||
WITH msg_attributes_cte AS (
|
||||
{# select 1 a #}
|
||||
WITH msg_attributes AS (
|
||||
|
||||
SELECT
|
||||
tx_id,
|
||||
@ -24,14 +22,11 @@ WITH msg_attributes_cte AS (
|
||||
FROM
|
||||
{{ ref('silver__msg_attributes') }} A
|
||||
WHERE
|
||||
msg_type IN (
|
||||
msg_type IN(
|
||||
'withdraw_rewards',
|
||||
'transfer',
|
||||
'message',
|
||||
'tx',
|
||||
'delegate',
|
||||
'redelegate',
|
||||
'unbond'
|
||||
'tx'
|
||||
)
|
||||
|
||||
{% if is_incremental() %}
|
||||
@ -45,290 +40,63 @@ AND _inserted_timestamp >= (
|
||||
)
|
||||
{% endif %}
|
||||
),
|
||||
reward_combo AS (
|
||||
reroll_msg AS (
|
||||
SELECT
|
||||
tx_id,
|
||||
msg_type,
|
||||
msg_group,
|
||||
msg_sub_group,
|
||||
msg_index,
|
||||
OBJECT_AGG(
|
||||
attribute_key :: STRING,
|
||||
attribute_value :: variant
|
||||
) AS j,
|
||||
j :validator :: STRING AS validator_address,
|
||||
j :amount :: STRING AS amount,
|
||||
j :sender :: STRING AS delegator_address
|
||||
) AS attributes
|
||||
FROM
|
||||
msg_attr_rewards
|
||||
WHERE
|
||||
attribute_key IN (
|
||||
'sender',
|
||||
'amount',
|
||||
'validator'
|
||||
)
|
||||
msg_attributes
|
||||
GROUP BY
|
||||
tx_id,
|
||||
msg_type,
|
||||
msg_group,
|
||||
msg_sub_group
|
||||
msg_sub_group,
|
||||
msg_index
|
||||
),
|
||||
claim_base AS (
|
||||
SELECT
|
||||
A.tx_id,
|
||||
A.msg_type,
|
||||
A.msg_index,
|
||||
msg_group
|
||||
FROM
|
||||
msg_attributes_cte A
|
||||
INNER JOIN (
|
||||
SELECT
|
||||
DISTINCT tx_id
|
||||
FROM
|
||||
msg_attributes_cte
|
||||
WHERE
|
||||
msg_type IN (
|
||||
'delegate',
|
||||
'redelegate'
|
||||
)
|
||||
) b
|
||||
ON A.tx_id = b.tx_id
|
||||
WHERE
|
||||
msg_type = 'claim'
|
||||
),
|
||||
claim_combo AS (
|
||||
flat AS (
|
||||
SELECT
|
||||
tx_id,
|
||||
msg_group,
|
||||
msg_sub_group,
|
||||
OBJECT_AGG(
|
||||
CASE
|
||||
WHEN msg_type IN (
|
||||
'message',
|
||||
'claim'
|
||||
) THEN msg_type || '__'
|
||||
ELSE ''
|
||||
END || attribute_key :: STRING,
|
||||
attribute_value :: variant
|
||||
) AS j,
|
||||
COALESCE(
|
||||
j :validator :: STRING,
|
||||
j :source_validator :: STRING
|
||||
) AS validator_address,
|
||||
j :claim__amount :: STRING AS amount,
|
||||
j :message__sender :: STRING AS delegator_address
|
||||
msg_type,
|
||||
attributes :amount :: STRING AS amount,
|
||||
attributes :validator :: STRING AS validator_address,
|
||||
attributes :recipient :: STRING AS delegator_address,
|
||||
attributes :recipient :: STRING AS rewards_recipient
|
||||
FROM
|
||||
msg_attr_claim
|
||||
reroll_msg
|
||||
WHERE
|
||||
msg_type || '__' || attribute_key IN (
|
||||
'message__sender',
|
||||
'claim__amount'
|
||||
msg_type IN (
|
||||
'withdraw_rewards',
|
||||
'transfer'
|
||||
)
|
||||
OR attribute_key IN (
|
||||
'validator',
|
||||
'source_validator'
|
||||
)
|
||||
GROUP BY
|
||||
tx_id,
|
||||
msg_group,
|
||||
msg_sub_group
|
||||
),
|
||||
tran_base AS (
|
||||
SELECT
|
||||
DISTINCT tx_id,
|
||||
msg_group,
|
||||
msg_sub_group,
|
||||
delegator_address
|
||||
FROM
|
||||
{{ ref('silver__staking') }} A
|
||||
|
||||
{% if is_incremental() %}
|
||||
WHERE
|
||||
_inserted_timestamp >= (
|
||||
SELECT
|
||||
MAX(
|
||||
_inserted_timestamp
|
||||
)
|
||||
FROM
|
||||
max_date
|
||||
)
|
||||
{% endif %}
|
||||
),
|
||||
tran_tran AS (
|
||||
combo AS (
|
||||
SELECT
|
||||
A.tx_id,
|
||||
A.msg_type,
|
||||
A.msg_index,
|
||||
A.msg_group,
|
||||
attribute_key,
|
||||
attribute_value
|
||||
A.msg_sub_group,
|
||||
A.amount,
|
||||
A.validator_address,
|
||||
b.delegator_address,
|
||||
b.rewards_recipient
|
||||
FROM
|
||||
msg_attributes_cte A
|
||||
INNER JOIN tran_base b
|
||||
flat A
|
||||
JOIN flat b
|
||||
ON A.tx_id = b.tx_id
|
||||
AND A.msg_group = b.msg_group
|
||||
AND A.attribute_value = b.delegator_address
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
DISTINCT tx_id
|
||||
FROM
|
||||
msg_attributes_cte
|
||||
WHERE
|
||||
msg_type IN (
|
||||
'claim',
|
||||
'withdraw_rewards'
|
||||
)
|
||||
) C
|
||||
ON A.tx_id = C.tx_id
|
||||
AND A.msg_sub_group = b.msg_sub_group
|
||||
AND A.amount = b.amount
|
||||
WHERE
|
||||
A.msg_type = 'transfer'
|
||||
AND A.attribute_key = 'recipient'
|
||||
AND C.tx_id IS NULL
|
||||
),
|
||||
msg_attr_trans AS (
|
||||
SELECT
|
||||
A.tx_id,
|
||||
A.msg_group,
|
||||
A.msg_index,
|
||||
A.msg_type,
|
||||
A.attribute_key,
|
||||
A.attribute_value,
|
||||
DENSE_RANK() over(
|
||||
PARTITION BY A.tx_id,
|
||||
A.msg_group
|
||||
ORDER BY
|
||||
A.msg_index
|
||||
) change_index
|
||||
FROM
|
||||
tran_tran b
|
||||
JOIN msg_attributes_cte A
|
||||
ON A.tx_ID = b.tx_ID
|
||||
AND A.msg_group = b.msg_group
|
||||
WHERE
|
||||
A.msg_type IN (
|
||||
'delegate',
|
||||
'redelegate',
|
||||
'unbond'
|
||||
)
|
||||
OR (
|
||||
A.msg_index = b.msg_index
|
||||
AND A.msg_type = 'transfer'
|
||||
)
|
||||
),
|
||||
tran_combo AS (
|
||||
SELECT
|
||||
A.tx_id,
|
||||
A.msg_group,
|
||||
A.msg_index group_id,
|
||||
COALESCE(
|
||||
b.j :validator :: STRING,
|
||||
b.j :source_validator :: STRING
|
||||
) AS validator_address,
|
||||
A.j :amount :: STRING AS amount,
|
||||
A.j :recipient :: STRING AS delegator_address
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
tx_id,
|
||||
msg_group,
|
||||
msg_index,
|
||||
change_index + 1 group_id,
|
||||
OBJECT_AGG(
|
||||
attribute_key :: STRING,
|
||||
attribute_value :: variant
|
||||
) AS j
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
DISTINCT tx_id,
|
||||
msg_group,
|
||||
msg_index,
|
||||
change_index,
|
||||
attribute_key,
|
||||
attribute_value
|
||||
FROM
|
||||
msg_attr_trans
|
||||
WHERE
|
||||
msg_type = 'transfer'
|
||||
AND attribute_key IN (
|
||||
'amount',
|
||||
'recipient'
|
||||
)
|
||||
) x
|
||||
GROUP BY
|
||||
tx_id,
|
||||
msg_group,
|
||||
msg_index,
|
||||
group_id
|
||||
) A
|
||||
JOIN (
|
||||
SELECT
|
||||
tx_id,
|
||||
msg_group,
|
||||
msg_index,
|
||||
change_index group_id,
|
||||
OBJECT_AGG(
|
||||
attribute_key :: STRING,
|
||||
attribute_value :: variant
|
||||
) AS j
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
DISTINCT tx_id,
|
||||
msg_group,
|
||||
msg_index,
|
||||
change_index,
|
||||
attribute_key,
|
||||
attribute_value
|
||||
FROM
|
||||
msg_attr_trans
|
||||
WHERE
|
||||
msg_type <> 'transfer'
|
||||
AND attribute_key IN (
|
||||
'validator',
|
||||
'source_validator'
|
||||
)
|
||||
) x
|
||||
GROUP BY
|
||||
tx_id,
|
||||
msg_group,
|
||||
msg_index,
|
||||
group_id
|
||||
) b
|
||||
ON A.tx_id = b.tx_id
|
||||
AND A.msg_group = b.msg_group
|
||||
AND A.group_id = b.group_id
|
||||
),
|
||||
combo_all AS (
|
||||
SELECT
|
||||
tx_id,
|
||||
msg_group,
|
||||
group_id,
|
||||
validator_address,
|
||||
amount,
|
||||
delegator_address,
|
||||
'claim' AS action
|
||||
FROM
|
||||
tran_combo
|
||||
UNION ALL
|
||||
SELECT
|
||||
tx_id,
|
||||
msg_group,
|
||||
group_id,
|
||||
validator_address,
|
||||
amount,
|
||||
delegator_address,
|
||||
'withdraw_rewards' AS action
|
||||
FROM
|
||||
reward_combo
|
||||
UNION ALL
|
||||
SELECT
|
||||
tx_id,
|
||||
msg_group,
|
||||
group_id,
|
||||
validator_address,
|
||||
amount,
|
||||
delegator_address,
|
||||
'claim' AS action
|
||||
FROM
|
||||
claim_combo
|
||||
A.msg_type = 'withdraw_rewards'
|
||||
AND b.msg_type = 'transfer'
|
||||
),
|
||||
tx_address AS (
|
||||
SELECT
|
||||
@ -344,7 +112,7 @@ tx_address AS (
|
||||
1
|
||||
) AS acc_seq_index
|
||||
FROM
|
||||
msg_attributes_cte A
|
||||
msg_attributes A
|
||||
WHERE
|
||||
attribute_key = 'acc_seq' qualify(ROW_NUMBER() over (PARTITION BY tx_id
|
||||
ORDER BY
|
||||
@ -357,9 +125,10 @@ prefinal AS (
|
||||
A.tx_id,
|
||||
b.tx_succeeded,
|
||||
C.tx_caller_address,
|
||||
A.action,
|
||||
A.msg_group,
|
||||
A.msg_sub_group,
|
||||
A.delegator_address,
|
||||
A.rewards_recipient,
|
||||
SUM(
|
||||
CASE
|
||||
WHEN A.split_amount LIKE '%usei' THEN REPLACE(
|
||||
@ -382,14 +151,15 @@ prefinal AS (
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
p.tx_Id,
|
||||
p.action,
|
||||
p.tx_id,
|
||||
p.msg_group,
|
||||
p.msg_sub_group,
|
||||
p.delegator_address,
|
||||
p.validator_address,
|
||||
p.rewards_recipient,
|
||||
am.value AS split_amount
|
||||
FROM
|
||||
combo_all p,
|
||||
combo p,
|
||||
LATERAL SPLIT_TO_TABLE(
|
||||
p.amount,
|
||||
','
|
||||
@ -397,45 +167,35 @@ prefinal AS (
|
||||
) A
|
||||
JOIN (
|
||||
SELECT
|
||||
tx_ID,
|
||||
DISTINCT tx_id,
|
||||
block_id,
|
||||
block_timestamp,
|
||||
tx_succeeded,
|
||||
_inserted_timestamp
|
||||
FROM
|
||||
{{ ref('silver__transactions') }} A
|
||||
|
||||
{% if is_incremental() %}
|
||||
WHERE
|
||||
_inserted_timestamp >= (
|
||||
SELECT
|
||||
MAX(
|
||||
_inserted_timestamp
|
||||
)
|
||||
FROM
|
||||
max_date
|
||||
)
|
||||
{% endif %}
|
||||
) b
|
||||
ON A.tx_Id = b.tx_ID
|
||||
JOIN tx_address C
|
||||
ON A.tx_id = C.tx_id
|
||||
GROUP BY
|
||||
b.block_id,
|
||||
b.block_timestamp,
|
||||
A.tx_id,
|
||||
b.tx_succeeded,
|
||||
C.tx_caller_address,
|
||||
A.action,
|
||||
A.msg_group,
|
||||
A.delegator_address,CASE
|
||||
WHEN A.split_amount LIKE '%usei' THEN 'usei'
|
||||
WHEN A.split_amount LIKE '%pool%' THEN SUBSTRING(A.split_amount, CHARINDEX('g', A.split_amount), 99)
|
||||
WHEN A.split_amount LIKE '%ibc%' THEN SUBSTRING(A.split_amount, CHARINDEX('i', A.split_amount), 99)
|
||||
ELSE 'usei'
|
||||
END,
|
||||
A.validator_address,
|
||||
b._inserted_timestamp
|
||||
msg_attributes
|
||||
) b
|
||||
ON A.tx_id = b.tx_id
|
||||
JOIN tx_address C
|
||||
ON A.tx_id = C.tx_id
|
||||
GROUP BY
|
||||
b.block_id,
|
||||
b.block_timestamp,
|
||||
A.tx_id,
|
||||
b.tx_succeeded,
|
||||
C.tx_caller_address,
|
||||
A.msg_group,
|
||||
A.msg_sub_group,
|
||||
A.delegator_address,
|
||||
A.rewards_recipient,
|
||||
CASE
|
||||
WHEN A.split_amount LIKE '%usei' THEN 'usei'
|
||||
WHEN A.split_amount LIKE '%pool%' THEN SUBSTRING(A.split_amount, CHARINDEX('g', A.split_amount), 99)
|
||||
WHEN A.split_amount LIKE '%ibc%' THEN SUBSTRING(A.split_amount, CHARINDEX('i', A.split_amount), 99)
|
||||
ELSE 'usei'
|
||||
END,
|
||||
A.validator_address,
|
||||
b._inserted_timestamp
|
||||
)
|
||||
SELECT
|
||||
block_id,
|
||||
@ -443,9 +203,10 @@ SELECT
|
||||
A.tx_id,
|
||||
A.tx_succeeded,
|
||||
A.tx_caller_address,
|
||||
A.action,
|
||||
A.msg_group,
|
||||
A.msg_sub_group,
|
||||
A.delegator_address,
|
||||
A.rewards_recipient,
|
||||
A.amount,
|
||||
A.currency,
|
||||
A.validator_address,
|
||||
@ -454,10 +215,10 @@ SELECT
|
||||
'-',
|
||||
A.tx_id,
|
||||
A.msg_group,
|
||||
A.action,
|
||||
A.msg_sub_group,
|
||||
A.currency,
|
||||
A.delegator_address,
|
||||
A.validator_address
|
||||
) AS _unique_key
|
||||
FROM
|
||||
prefinal A #}
|
||||
prefinal A
|
||||
|
||||
106
models/silver/silver__staking_rewards.yml
Normal file
106
models/silver/silver__staking_rewards.yml
Normal file
@ -0,0 +1,106 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: silver__staking_rewards
|
||||
description: Records of all claimed rewards earned from staking that have occurred on Sei, dating back to the genesis block. These actions include claim and withdrawal_rewards.
|
||||
tests:
|
||||
- dbt_utils.unique_combination_of_columns:
|
||||
combination_of_columns:
|
||||
- TX_ID
|
||||
- MSG_GROUP
|
||||
- MSG_SUB_GROUP
|
||||
- CURRENCY
|
||||
- DELEGATOR_ADDRESS
|
||||
- VALIDATOR_ADDRESS
|
||||
columns:
|
||||
- name: BLOCK_ID
|
||||
description: "{{ doc('block_id') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- NUMBER
|
||||
- FLOAT
|
||||
- name: BLOCK_TIMESTAMP
|
||||
description: "{{ doc('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
|
||||
- name: TX_ID
|
||||
description: "{{ doc('tx_id') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
- name: TX_SUCCEEDED
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- BOOLEAN
|
||||
- name: TX_CALLER_ADDRESS
|
||||
description: "{{ doc('tx_caller_address') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
- dbt_expectations.expect_column_values_to_match_regex:
|
||||
regex: sei1[0-9a-z]{38,38}
|
||||
- name: MSG_GROUP
|
||||
description: "{{ doc('msg_group') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- NUMBER
|
||||
- FLOAT
|
||||
- name: DELEGATOR_ADDRESS
|
||||
description: "{{ doc('delegator_address') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
- dbt_expectations.expect_column_values_to_match_regex:
|
||||
regex: sei1[0-9a-z]{38,38}
|
||||
- name: AMOUNT
|
||||
description: "{{ doc('amount') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- NUMBER
|
||||
- FLOAT
|
||||
- name: CURRENCY
|
||||
description: "{{ doc('currency') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
- name: VALIDATOR_ADDRESS
|
||||
description: "{{ doc('validator_address') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
- dbt_expectations.expect_column_values_to_match_regex:
|
||||
regex: seivaloper1[0-9a-z]{38,38}
|
||||
- name: _INSERTED_TIMESTAMP
|
||||
description: "{{ doc('inserted_timestamp') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- TIMESTAMP_NTZ
|
||||
@ -143,7 +143,7 @@ receiver_ibc AS (
|
||||
msg_group,
|
||||
msg_sub_group
|
||||
),
|
||||
osmo_tx_ids AS (
|
||||
sei_tx_ids AS (
|
||||
SELECT
|
||||
DISTINCT tx_id
|
||||
FROM
|
||||
@ -156,13 +156,13 @@ osmo_tx_ids AS (
|
||||
)
|
||||
OR msg_type = 'claim'
|
||||
),
|
||||
message_indexes_osmo AS (
|
||||
message_indexes_sei AS (
|
||||
SELECT
|
||||
v.tx_id,
|
||||
attribute_key,
|
||||
m.msg_index
|
||||
FROM
|
||||
osmo_tx_ids v
|
||||
sei_tx_ids v
|
||||
LEFT OUTER JOIN base_atts m
|
||||
ON v.tx_id = m.tx_id
|
||||
INNER JOIN sender s
|
||||
@ -172,24 +172,24 @@ message_indexes_osmo AS (
|
||||
AND attribute_key = 'amount'
|
||||
AND m.msg_index > s.msg_index
|
||||
),
|
||||
osmo_receiver AS (
|
||||
sei_receiver AS (
|
||||
SELECT
|
||||
o.tx_id,
|
||||
m.msg_group,
|
||||
m.msg_index,
|
||||
attribute_value AS receiver
|
||||
FROM
|
||||
osmo_tx_ids o
|
||||
sei_tx_ids o
|
||||
LEFT OUTER JOIN base_atts m
|
||||
ON o.tx_id = m.tx_id
|
||||
LEFT OUTER JOIN message_indexes_osmo idx
|
||||
LEFT OUTER JOIN message_indexes_sei idx
|
||||
ON idx.tx_id = m.tx_id
|
||||
WHERE
|
||||
m.msg_type = 'transfer'
|
||||
AND m.attribute_key = 'recipient'
|
||||
AND idx.msg_index = m.msg_index
|
||||
),
|
||||
osmo_amount AS (
|
||||
sei_amount AS (
|
||||
SELECT
|
||||
o.tx_id,
|
||||
m.msg_index,
|
||||
@ -206,10 +206,10 @@ osmo_amount AS (
|
||||
) AS amount,
|
||||
RIGHT(attribute_value, LENGTH(attribute_value) - LENGTH(SPLIT_PART(TRIM(REGEXP_REPLACE(attribute_value, '[^[:digit:]]', ' ')), ' ', 0))) AS currency
|
||||
FROM
|
||||
osmo_tx_ids o
|
||||
sei_tx_ids o
|
||||
LEFT OUTER JOIN base_atts m
|
||||
ON o.tx_id = m.tx_id
|
||||
LEFT OUTER JOIN message_indexes_osmo idx
|
||||
LEFT OUTER JOIN message_indexes_sei idx
|
||||
ON idx.tx_id = m.tx_id
|
||||
WHERE
|
||||
m.msg_type = 'transfer'
|
||||
@ -298,8 +298,8 @@ fin AS (
|
||||
currency
|
||||
) AS _unique_key
|
||||
FROM
|
||||
osmo_receiver r
|
||||
LEFT OUTER JOIN osmo_amount C
|
||||
sei_receiver r
|
||||
LEFT OUTER JOIN sei_amount C
|
||||
ON r.tx_id = C.tx_id
|
||||
AND r.msg_index = C.msg_index
|
||||
LEFT OUTER JOIN sender s
|
||||
|
||||
94
models/silver/silver__transfers.yml
Normal file
94
models/silver/silver__transfers.yml
Normal file
@ -0,0 +1,94 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: silver__transfers
|
||||
description: Records of all transfers on Sei, including IBC transfers as on- and off-ramps to Sei and wallet to wallet transfers
|
||||
tests:
|
||||
- dbt_utils.unique_combination_of_columns:
|
||||
combination_of_columns:
|
||||
- TX_ID
|
||||
- MSG_INDEX
|
||||
- CURRENCY
|
||||
columns:
|
||||
- name: BLOCK_ID
|
||||
description: "{{ doc('block_id') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- NUMBER
|
||||
- FLOAT
|
||||
- name: BLOCK_TIMESTAMP
|
||||
description: "{{ doc('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
|
||||
- name: TX_ID
|
||||
description: "{{ doc('tx_id') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
- name: TX_SUCCEEDED
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- BOOLEAN
|
||||
- name: TRANSFER_TYPE
|
||||
description: "{{ doc('transfer_type') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
- name: SENDER
|
||||
description: "{{ doc('sender') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
- name: AMOUNT
|
||||
description: "{{ doc('amount') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- NUMBER
|
||||
- FLOAT
|
||||
- name: CURRENCY
|
||||
description: "{{ doc('currency') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
- name: RECEIVER
|
||||
description: "{{ doc('receiver') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
# - name: FOREIGN_ADDRESS
|
||||
# description: "{{ doc('foreign_address') }}"
|
||||
# - name: FOREIGN_CHAIN
|
||||
# description: "{{ doc('foreign_chain') }}"
|
||||
- name: _INSERTED_TIMESTAMP
|
||||
description: "{{ doc('inserted_timestamp') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- TIMESTAMP_NTZ
|
||||
Loading…
Reference in New Issue
Block a user