mirror of
https://github.com/FlipsideCrypto/axelar-models.git
synced 2026-02-06 13:56:46 +00:00
gold view
This commit is contained in:
parent
f3e4f7865e
commit
454b48ed71
5
models/descriptions/fee.md
Normal file
5
models/descriptions/fee.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs fee %}
|
||||
|
||||
The fee is paid by the initiator of the transaction. Fee = gas * gas price and is given in micro-OSMO.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/tx_from.md
Normal file
5
models/descriptions/tx_from.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs tx_from %}
|
||||
|
||||
The wallet address of the individual who initiated the transaction
|
||||
|
||||
{% enddocs %}
|
||||
13
models/gold/core__fact_blocks.sql
Normal file
13
models/gold/core__fact_blocks.sql
Normal file
@ -0,0 +1,13 @@
|
||||
{{ config(
|
||||
materialized = 'view'
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
block_id,
|
||||
block_timestamp,
|
||||
chain_id,
|
||||
tx_count,
|
||||
proposer_address,
|
||||
validator_hash
|
||||
FROM
|
||||
{{ ref('silver__blocks') }}
|
||||
29
models/gold/core__fact_blocks.yml
Normal file
29
models/gold/core__fact_blocks.yml
Normal file
@ -0,0 +1,29 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: core__fact_blocks
|
||||
description: Records of all blocks that have occurred on Axelar, dating back to the genesis block.
|
||||
columns:
|
||||
- name: BLOCK_ID
|
||||
description: "{{ doc('block_id') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: BLOCK_TIMESTAMP
|
||||
description: "{{ doc('block_timestamp') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: CHAIN_ID
|
||||
description: "{{ doc('chain_id') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: TX_COUNT
|
||||
description: "{{ doc('tx_count') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: PROPOSER_ADDRESS
|
||||
description: "{{ doc('proposer_address') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: VALIDATOR_HASH
|
||||
description: "{{ doc('validator_hash') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
23
models/gold/core__fact_msg_attributes.sql
Normal file
23
models/gold/core__fact_msg_attributes.sql
Normal file
@ -0,0 +1,23 @@
|
||||
{{ config(
|
||||
materialized = 'view'
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
block_id,
|
||||
block_timestamp,
|
||||
blockchain,
|
||||
chain_id,
|
||||
tx_id,
|
||||
tx_succeeded,
|
||||
CONCAT(
|
||||
msg_group,
|
||||
':',
|
||||
msg_sub_group
|
||||
) AS msg_group,
|
||||
msg_index,
|
||||
msg_type,
|
||||
attribute_index,
|
||||
attribute_key,
|
||||
attribute_value
|
||||
FROM
|
||||
{{ ref('silver__msg_attributes') }}
|
||||
54
models/gold/core__fact_msg_attributes.yml
Normal file
54
models/gold/core__fact_msg_attributes.yml
Normal file
@ -0,0 +1,54 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: core__fact_msg_attributes
|
||||
description: Records of all message attributes associated to messages that have occurred on Axelar, dating back to the genesis block.
|
||||
columns:
|
||||
- name: BLOCK_ID
|
||||
description: "{{ doc('block_id') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: BLOCK_TIMESTAMP
|
||||
description: "{{ doc('block_timestamp') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: BLOCKCHAIN
|
||||
description: "{{ doc('blockchain') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: CHAIN_ID
|
||||
description: "{{ doc('chain_id') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: TX_ID
|
||||
description: "{{ doc('tx_id') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: TX_SUCCEEDED
|
||||
description: "{{ doc('tx_succeeded') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: MSG_GROUP
|
||||
description: "{{ doc('msg_group') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: MSG_INDEX
|
||||
description: "{{ doc('msg_index') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: MSG_TYPE
|
||||
description: "{{ doc('msg_type') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: ATTRIBUTE_INDEX
|
||||
description: "The index from the key-value pair from the message attribute"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: ATTRIBUTE_KEY
|
||||
description: "The key from the key-value pair from the message attribute"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: ATTRIBUTE_VALUE
|
||||
description: "The value from the key-value pair from the message attribute"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
|
||||
21
models/gold/core__fact_msgs.sql
Normal file
21
models/gold/core__fact_msgs.sql
Normal file
@ -0,0 +1,21 @@
|
||||
{{ config(
|
||||
materialized = 'view'
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
block_id,
|
||||
block_timestamp,
|
||||
blockchain,
|
||||
chain_id,
|
||||
tx_id,
|
||||
tx_succeeded,
|
||||
CONCAT(
|
||||
msg_group,
|
||||
':',
|
||||
msg_sub_group
|
||||
) AS msg_group,
|
||||
msg_index,
|
||||
msg_type,
|
||||
msg
|
||||
FROM
|
||||
{{ ref('silver__msgs') }}
|
||||
46
models/gold/core__fact_msgs.yml
Normal file
46
models/gold/core__fact_msgs.yml
Normal file
@ -0,0 +1,46 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: core__fact_msgs
|
||||
description: Records of all message attributes associated to messages that have occurred on Axelar, dating back to the genesis block.
|
||||
columns:
|
||||
- name: BLOCK_ID
|
||||
description: "{{ doc('block_id') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: BLOCK_TIMESTAMP
|
||||
description: "{{ doc('block_timestamp') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: BLOCKCHAIN
|
||||
description: "{{ doc('blockchain') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: CHAIN_ID
|
||||
description: "{{ doc('chain_id') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: TX_ID
|
||||
description: "{{ doc('tx_id') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: TX_SUCCEEDED
|
||||
description: "{{ doc('tx_succeeded') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: MSG_GROUP
|
||||
description: "{{ doc('msg_group') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: MSG_INDEX
|
||||
description: "{{ doc('msg_index') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: MSG_TYPE
|
||||
description: "{{ doc('msg_type') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: MSG
|
||||
description: "A block of json that contains the message attributes in base64 encoding."
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
|
||||
148
models/gold/core__fact_transactions.sql
Normal file
148
models/gold/core__fact_transactions.sql
Normal file
@ -0,0 +1,148 @@
|
||||
{{ config(
|
||||
materialized = 'incremental',
|
||||
unique_key = "tx_id",
|
||||
incremental_strategy = 'merge',
|
||||
cluster_by = ['block_timestamp::DATE'],
|
||||
) }}
|
||||
|
||||
with {% if is_incremental() %}
|
||||
max_block_partition AS (
|
||||
|
||||
SELECT
|
||||
MAX(
|
||||
_partition_by_block_id
|
||||
) as _partition_by_block_id_max
|
||||
|
||||
from {{ ref('silver__transactions') }}
|
||||
|
||||
),
|
||||
|
||||
{% endif %}
|
||||
|
||||
fee AS (
|
||||
|
||||
SELECT
|
||||
tx_id,
|
||||
attribute_value AS fee
|
||||
FROM
|
||||
{{ ref('silver__msg_attributes') }}
|
||||
WHERE
|
||||
attribute_key = 'fee'
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND
|
||||
_partition_by_block_id >= (
|
||||
SELECT
|
||||
_partition_by_block_id_max -1
|
||||
FROM
|
||||
max_block_partition
|
||||
)
|
||||
AND _partition_by_block_id <= (
|
||||
SELECT
|
||||
_partition_by_block_id_max + 10
|
||||
FROM
|
||||
max_block_partition
|
||||
)
|
||||
{% else %}
|
||||
AND
|
||||
_partition_by_block_id IN (
|
||||
0,
|
||||
1
|
||||
)
|
||||
{% endif %}
|
||||
),
|
||||
|
||||
spender AS (
|
||||
SELECT
|
||||
tx_id,
|
||||
SPLIT_PART(
|
||||
attribute_value,
|
||||
'/',
|
||||
0
|
||||
) AS tx_from
|
||||
FROM
|
||||
{{ ref('silver__msg_attributes') }}
|
||||
WHERE
|
||||
attribute_key = 'acc_seq'
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND
|
||||
_partition_by_block_id >= (
|
||||
SELECT
|
||||
_partition_by_block_id_max -1
|
||||
FROM
|
||||
max_block_partition
|
||||
)
|
||||
AND _partition_by_block_id <= (
|
||||
SELECT
|
||||
_partition_by_block_id_max + 10
|
||||
FROM
|
||||
max_block_partition
|
||||
)
|
||||
{% else %}
|
||||
AND
|
||||
_partition_by_block_id IN (
|
||||
0,
|
||||
1
|
||||
)
|
||||
{% endif %}
|
||||
|
||||
qualify(ROW_NUMBER() over(PARTITION BY tx_id
|
||||
ORDER BY
|
||||
msg_index)) = 1
|
||||
)
|
||||
|
||||
|
||||
SELECT
|
||||
t.block_id,
|
||||
t.block_timestamp,
|
||||
t.blockchain,
|
||||
t.chain_id,
|
||||
t.tx_id,
|
||||
s.tx_from,
|
||||
tx_succeeded,
|
||||
codespace,
|
||||
COALESCE(
|
||||
fee,
|
||||
'0uaxl'
|
||||
) AS fee,
|
||||
gas_used,
|
||||
gas_wanted,
|
||||
tx_code,
|
||||
tx_log,
|
||||
msgs,
|
||||
_partition_by_block_id
|
||||
|
||||
from {{ ref('silver__transactions') }}
|
||||
t
|
||||
LEFT OUTER JOIN fee f
|
||||
ON t.tx_id = f.tx_id
|
||||
LEFT OUTER JOIN spender s
|
||||
ON t.tx_id = s.tx_id
|
||||
|
||||
{% if is_incremental() %}
|
||||
WHERE
|
||||
_partition_by_block_id >= (
|
||||
SELECT
|
||||
_partition_by_block_id_max -1
|
||||
FROM
|
||||
max_block_partition
|
||||
)
|
||||
AND _partition_by_block_id <= (
|
||||
SELECT
|
||||
_partition_by_block_id_max + 10
|
||||
FROM
|
||||
max_block_partition
|
||||
)
|
||||
{% else %}
|
||||
WHERE
|
||||
_partition_by_block_id IN (
|
||||
0,
|
||||
1
|
||||
)
|
||||
{% endif %}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
66
models/gold/core__fact_transactions.yml
Normal file
66
models/gold/core__fact_transactions.yml
Normal file
@ -0,0 +1,66 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: core__fact_transactions
|
||||
description: Records of all transactions that have occurred on Axelar, 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:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: BLOCK_TIMESTAMP
|
||||
description: "{{ doc('block_timestamp') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: BLOCKCHAIN
|
||||
description: "{{ doc('blockchain') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: CHAIN_ID
|
||||
description: "{{ doc('chain_id') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: TX_ID
|
||||
description: "{{ doc('tx_id') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: TX_FROM
|
||||
description: "{{ doc('tx_from') }}"
|
||||
tests:
|
||||
- not_null:
|
||||
where: TX_SUCCEEDED = 'TRUE'
|
||||
- name: TX_SUCCEEDED
|
||||
description: "{{ doc('tx_succeeded') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: CODESPACE
|
||||
description: "{{ doc('codespace') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: FEE
|
||||
description: "{{ doc('fee') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- name: GAS_USED
|
||||
description: "{{ doc('gas_used') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: GAS_WANTED
|
||||
description: "{{ doc('gas_wanted') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: TX_CODE
|
||||
description: "{{ doc('tx_code') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: TX_LOG
|
||||
description: "{{ doc('tx_log') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: MSGS
|
||||
description: "The underlying json from the messages or events within the transactions"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
18
models/gold/core__fact_transfers.sql
Normal file
18
models/gold/core__fact_transfers.sql
Normal file
@ -0,0 +1,18 @@
|
||||
{{ config(
|
||||
materialized = 'view'
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
block_id,
|
||||
block_timestamp,
|
||||
blockchain,
|
||||
chain_id,
|
||||
tx_id,
|
||||
tx_succeeded,
|
||||
transfer_type,
|
||||
sender,
|
||||
amount,
|
||||
currency,
|
||||
receiver
|
||||
|
||||
FROM {{ ref('silver__transfers') }}
|
||||
49
models/gold/core__fact_transfers.yml
Normal file
49
models/gold/core__fact_transfers.yml
Normal file
@ -0,0 +1,49 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: core__fact_transfers
|
||||
description: Records of all transfers on Axelar
|
||||
columns:
|
||||
- name: BLOCK_ID
|
||||
description: "{{ doc('block_id') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: BLOCK_TIMESTAMP
|
||||
description: "{{ doc('block_timestamp') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: BLOCKCHAIN
|
||||
description: "{{ doc('blockchain') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: CHAIN_ID
|
||||
description: "{{ doc('chain_id') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: TX_ID
|
||||
description: "{{ doc('tx_id') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: TX_SUCCEEDED
|
||||
description: "{{ doc('tx_succeeded') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: TRANSFER_TYPE
|
||||
description: "{{ doc('transfer_type') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: SENDER
|
||||
description: "{{ doc('sender') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: AMOUNT
|
||||
description: "{{ doc('amount') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: CURRENCY
|
||||
description: "{{ doc('currency') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: RECEIVER
|
||||
description: "{{ doc('receiver') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
@ -11,6 +11,7 @@ SELECT
|
||||
blockchain,
|
||||
chain_id,
|
||||
tx_id,
|
||||
tx_succeeded,
|
||||
msg_group,
|
||||
msg_sub_group,
|
||||
msg_index,
|
||||
|
||||
@ -29,6 +29,10 @@ models:
|
||||
description: "{{ doc('tx_id') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- name: TX_SUCCEEDED
|
||||
description: "{{ doc('tx_succeeded') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- name: MSG_GROUP
|
||||
description: "{{ doc('msg_group') }}"
|
||||
- name: MSG_SUB_GROUP
|
||||
|
||||
Loading…
Reference in New Issue
Block a user