mirror of
https://github.com/FlipsideCrypto/osmosis-models.git
synced 2026-02-06 13:57:16 +00:00
An 1249 lp actions (#25)
* LP actions model and tests
* Fix to one token LPs
* flattened out tokens, added decimal, updated docs and test
* pool id change - remove array
* aggregates currencies and groups by msg_index
* Revert "pool id change - remove array"
This reverts commit dc4185d51f.
* lucid chart change round 1
* transfers updates
* LP actions - flattened
* change vote weight to float
This commit is contained in:
parent
02520e9a95
commit
15832efa73
@ -1,5 +1,9 @@
|
||||
{% docs action %}
|
||||
|
||||
<<<<<<< HEAD
|
||||
Tells what action is happening in the transaction. I.E. is the user adding or removing liquidity to the pool.
|
||||
=======
|
||||
The action taken in the msg group. For staking this includes delegate, undelegate, redelegate, withdraw_rewards.
|
||||
>>>>>>> main
|
||||
|
||||
{% enddocs %}
|
||||
@ -1,5 +0,0 @@
|
||||
{% docs currency_sent %}
|
||||
|
||||
The currency that the user transferred between wallets.
|
||||
|
||||
{% enddocs %}
|
||||
@ -1,5 +0,0 @@
|
||||
{% docs currency_sent_decimal %}
|
||||
|
||||
Divide the swap_from_amount by POW(10, swap_from_decimal) to get the amount the user transferred.
|
||||
|
||||
{% enddocs %}
|
||||
@ -1,5 +0,0 @@
|
||||
{% docs deposit_amount %}
|
||||
|
||||
The amount that the user deposited into a proposal.
|
||||
|
||||
{% enddocs %}
|
||||
@ -1,5 +0,0 @@
|
||||
{% docs deposit_currency %}
|
||||
|
||||
The currency that the user used to deposited into a proposal.
|
||||
|
||||
{% enddocs %}
|
||||
@ -1,4 +1,4 @@
|
||||
{% docs swap_to_amount %}
|
||||
{% docs from_amount %}
|
||||
|
||||
The amount that the user sent to be swapped for another currency.
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
{% docs swap_to_currency %}
|
||||
{% docs from_currency %}
|
||||
|
||||
The currency that the user sent to be swapped for another currency.
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
{% docs swap_from_decimal %}
|
||||
{% docs from_decimal %}
|
||||
|
||||
Divide the swap_from_amount by POW(10, swap_from_decimal) to get the amount the user swapped.
|
||||
|
||||
5
models/descriptions/liquidity_provider_address.md
Normal file
5
models/descriptions/liquidity_provider_address.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs liquidity_provider_address %}
|
||||
|
||||
The address of user that provided or removed liquidity from the pool.
|
||||
|
||||
{% 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 %}
|
||||
@ -1,4 +1,4 @@
|
||||
{% docs swap_from_amount %}
|
||||
{% docs to_amount %}
|
||||
|
||||
The amount that the user sent to be swapped for another currency.
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
{% docs swap_from_currency %}
|
||||
{% docs to_currency %}
|
||||
|
||||
The currency that the user sent to be swapped for another currency.
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
{% docs swap_to_decimal %}
|
||||
{% docs to_decimal %}
|
||||
|
||||
Divide the swap_to_amount by POW(10, swap_to_decimal) to get the amount the user received.
|
||||
|
||||
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 Osmosis. "IBC_transfer_out" = withdrawing tokens from Osmosis. "Osmosis" = wallet to wallet transfer on Osmosis.
|
||||
|
||||
{% enddocs %}
|
||||
@ -31,9 +31,10 @@ deposit_value AS (
|
||||
),
|
||||
' ',
|
||||
0
|
||||
) / POW(10, COALESCE(raw_metadata[1]:exponent, 0)) AS deposit_amount,
|
||||
) / POW(10, COALESCE(raw_metadata[1]:exponent, 0)) AS amount,
|
||||
|
||||
RIGHT(attribute_value, LENGTH(attribute_value) - LENGTH(SPLIT_PART(TRIM(REGEXP_REPLACE(attribute_value, '[^[:digit:]]', ' ')), ' ', 0))) AS deposit_currency
|
||||
RIGHT(attribute_value, LENGTH(attribute_value) - LENGTH(SPLIT_PART(TRIM(REGEXP_REPLACE(attribute_value, '[^[:digit:]]', ' ')), ' ', 0))) AS currency,
|
||||
raw_metadata [1] :exponent AS decimal
|
||||
|
||||
FROM {{ ref('silver__msg_attributes') }} m
|
||||
|
||||
@ -72,8 +73,9 @@ SELECT
|
||||
tx_status,
|
||||
d.depositor,
|
||||
p.proposal_id,
|
||||
v.deposit_amount,
|
||||
v.deposit_currency,
|
||||
v.amount,
|
||||
v.currency,
|
||||
decimal,
|
||||
_ingested_at
|
||||
FROM deposit_value v
|
||||
|
||||
|
||||
@ -46,12 +46,16 @@ models:
|
||||
description: "{{ doc('proposal_id') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- name: DEPOSIT_AMOUNT
|
||||
description: "{{ doc('deposit_amount') }}"
|
||||
- name: AMOUNT
|
||||
description: "{{ doc('amount') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- name: DEPOSIT_CURRENCY
|
||||
description: "{{ doc('deposit_amount') }}"
|
||||
- name: CURRENCY
|
||||
description: "{{ doc('currency') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- name: DECIMAL
|
||||
description: "{{ doc('decimal') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- name: _INGESTED_AT
|
||||
|
||||
@ -21,7 +21,7 @@ WITH vote_options AS (
|
||||
ELSE
|
||||
TRY_PARSE_JSON(attribute_value):option
|
||||
END AS vote_option,
|
||||
TRY_PARSE_JSON(attribute_value):weight :: INTEGER AS vote_weight
|
||||
TRY_PARSE_JSON(attribute_value):weight :: FLOAT AS vote_weight
|
||||
FROM {{ ref('silver__msg_attributes') }}
|
||||
WHERE msg_type = 'proposal_vote'
|
||||
AND attribute_key = 'option'
|
||||
|
||||
161
models/silver/silver__liquidity_provider_actions.sql
Normal file
161
models/silver/silver__liquidity_provider_actions.sql
Normal file
@ -0,0 +1,161 @@
|
||||
{{ config(
|
||||
materialized = 'incremental',
|
||||
unique_key = "CONCAT_WS('-', tx_id, msg_index)",
|
||||
incremental_strategy = 'delete+insert',
|
||||
cluster_by = ['_ingested_at::DATE'],
|
||||
) }}
|
||||
|
||||
WITH message_indexes AS (
|
||||
|
||||
SELECT
|
||||
tx_id,
|
||||
attribute_key,
|
||||
msg_index
|
||||
FROM
|
||||
{{ ref('silver__msg_attributes') }}
|
||||
WHERE
|
||||
(msg_type = 'pool_exited'
|
||||
OR msg_type = 'pool_joined')
|
||||
AND (attribute_key = 'tokens_in'
|
||||
OR attribute_key = 'tokens_out')
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _ingested_at :: DATE >= CURRENT_DATE - 2
|
||||
{% endif %}
|
||||
|
||||
),
|
||||
|
||||
pool_ids AS (
|
||||
SELECT
|
||||
a.tx_id,
|
||||
a.msg_index,
|
||||
attribute_value :: INTEGER AS pool_id
|
||||
|
||||
FROM
|
||||
{{ ref('silver__msg_attributes') }} a
|
||||
|
||||
LEFT OUTER JOIN message_indexes m
|
||||
ON a.tx_id = m.tx_id
|
||||
|
||||
WHERE
|
||||
(msg_type = 'pool_exited'
|
||||
OR msg_type = 'pool_joined')
|
||||
AND
|
||||
a.attribute_key = 'pool_id'
|
||||
AND
|
||||
a.msg_index = m.msg_index
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _ingested_at :: DATE >= CURRENT_DATE - 2
|
||||
{% endif %}
|
||||
|
||||
),
|
||||
|
||||
token_array AS (
|
||||
SELECT
|
||||
a.tx_id,
|
||||
a.msg_index,
|
||||
msg_type AS action,
|
||||
split(attribute_value, ',') AS tokens
|
||||
FROM
|
||||
{{ ref('silver__msg_attributes') }} a
|
||||
|
||||
LEFT OUTER JOIN message_indexes m
|
||||
ON a.tx_id = m.tx_id
|
||||
AND a.attribute_key = m.attribute_key
|
||||
|
||||
WHERE
|
||||
(msg_type = 'pool_exited'
|
||||
OR msg_type = 'pool_joined')
|
||||
AND
|
||||
(a.attribute_key = 'tokens_in'
|
||||
OR a.attribute_key = 'tokens_out')
|
||||
|
||||
AND a.msg_index = m.msg_index
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _ingested_at :: DATE >= CURRENT_DATE - 2
|
||||
{% endif %}
|
||||
|
||||
),
|
||||
|
||||
tokens AS (
|
||||
SELECT
|
||||
tx_id,
|
||||
msg_index,
|
||||
action,
|
||||
SPLIT_PART(
|
||||
TRIM(
|
||||
REGEXP_REPLACE(
|
||||
t.value,
|
||||
'[^[:digit:]]',
|
||||
' '
|
||||
)
|
||||
),
|
||||
' ',
|
||||
0)::INTEGER AS amount,
|
||||
RIGHT(t.value, LENGTH(t.value) - LENGTH(SPLIT_PART(TRIM(REGEXP_REPLACE(t.value, '[^[:digit:]]', ' ')), ' ', 0)))::STRING AS currency
|
||||
FROM token_array,
|
||||
LATERAL FLATTEN (input => tokens) t
|
||||
),
|
||||
|
||||
decimals AS (
|
||||
SELECT
|
||||
tx_id,
|
||||
msg_index,
|
||||
action,
|
||||
amount,
|
||||
currency,
|
||||
raw_metadata [1] :exponent AS decimal
|
||||
FROM tokens t
|
||||
|
||||
LEFT OUTER JOIN {{ ref('silver__asset_metadata') }}
|
||||
ON currency = address
|
||||
),
|
||||
|
||||
lper AS (
|
||||
SELECT
|
||||
tx_id,
|
||||
split_part(attribute_value, '/', 0) as liquidity_provider_address
|
||||
FROM {{ ref('silver__msg_attributes') }}
|
||||
WHERE attribute_key = 'acc_seq'
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _ingested_at :: DATE >= CURRENT_DATE - 2
|
||||
{% endif %}
|
||||
)
|
||||
|
||||
SELECT
|
||||
tx.block_id,
|
||||
tx.block_timestamp,
|
||||
tx.blockchain,
|
||||
tx.chain_id,
|
||||
d.tx_id,
|
||||
tx_status,
|
||||
d.msg_index,
|
||||
liquidity_provider_address,
|
||||
action,
|
||||
pool_id,
|
||||
amount,
|
||||
currency,
|
||||
decimal,
|
||||
_ingested_at
|
||||
FROM decimals d
|
||||
|
||||
LEFT OUTER JOIN pool_ids p
|
||||
ON d.tx_id = p.tx_id
|
||||
AND d.msg_index = p.msg_index
|
||||
|
||||
LEFT OUTER JOIN lper l
|
||||
ON d.tx_id = l.tx_id
|
||||
|
||||
LEFT OUTER JOIN {{ ref('silver__transactions') }} tx
|
||||
ON d.tx_id = tx.tx_id
|
||||
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _ingested_at :: DATE >= CURRENT_DATE - 2
|
||||
{% endif %}
|
||||
|
||||
|
||||
|
||||
71
models/silver/silver__liquidity_provider_actions.yml
Normal file
71
models/silver/silver__liquidity_provider_actions.yml
Normal file
@ -0,0 +1,71 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: silver__liquidity_provider_actions
|
||||
description: Includes all actions entering and exiting liquidity pools
|
||||
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_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- TIMESTAMP_NTZ
|
||||
- name: BLOCKCHAIN
|
||||
description: "{{ doc('blockchain') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- name: CHAIN_ID
|
||||
description: "{{ doc('chain_id') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- name: TX_ID
|
||||
description: "{{ doc('tx_id') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- name: TX_STATUS
|
||||
description: "{{ doc('tx_status') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- name: LIQUIDITY_PROVIDER_ADDRESS
|
||||
description: "{{ doc('liquidity_provider_address') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- name: ACTION
|
||||
description: "{{ doc('action') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- name: POOL_ID
|
||||
description: "{{ doc('pool_id') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- name: AMOUNT
|
||||
description: "{{ doc('amount') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- name: CURRENCY
|
||||
description: "{{ doc('currency') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- name: DECIMAL
|
||||
description: "{{ doc('decimal') }}"
|
||||
- name: _INGESTED_AT
|
||||
description: "{{ doc('ingested_at') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- TIMESTAMP_NTZ
|
||||
@ -41,9 +41,9 @@ tokens_in AS (
|
||||
),
|
||||
' ',
|
||||
0
|
||||
) AS swap_from_amount,
|
||||
RIGHT(attribute_value, LENGTH(attribute_value) - LENGTH(SPLIT_PART(TRIM(REGEXP_REPLACE(attribute_value, '[^[:digit:]]', ' ')), ' ', 0))) AS swap_from_currency,
|
||||
l.raw_metadata [1] :exponent AS swap_from_decimal
|
||||
) AS from_amount,
|
||||
RIGHT(attribute_value, LENGTH(attribute_value) - LENGTH(SPLIT_PART(TRIM(REGEXP_REPLACE(attribute_value, '[^[:digit:]]', ' ')), ' ', 0))) AS from_currency,
|
||||
l.raw_metadata [1] :exponent AS from_decimal
|
||||
FROM
|
||||
{{ ref('silver__msg_attributes') }}
|
||||
t
|
||||
@ -62,6 +62,7 @@ tokens_in AS (
|
||||
AND _ingested_at :: DATE >= CURRENT_DATE - 2
|
||||
{% endif %}
|
||||
),
|
||||
|
||||
tokens_out AS (
|
||||
SELECT
|
||||
t.tx_id,
|
||||
@ -75,9 +76,9 @@ tokens_out AS (
|
||||
),
|
||||
' ',
|
||||
0
|
||||
) AS swap_to_amount,
|
||||
RIGHT(attribute_value, LENGTH(attribute_value) - LENGTH(SPLIT_PART(TRIM(REGEXP_REPLACE(attribute_value, '[^[:digit:]]', ' ')), ' ', 0))) AS swap_to_currency,
|
||||
l.raw_metadata [1] :exponent AS swap_to_decimal
|
||||
) AS to_amount,
|
||||
RIGHT(attribute_value, LENGTH(attribute_value) - LENGTH(SPLIT_PART(TRIM(REGEXP_REPLACE(attribute_value, '[^[:digit:]]', ' ')), ' ', 0))) AS to_currency,
|
||||
l.raw_metadata [1] :exponent AS to_decimal
|
||||
FROM
|
||||
{{ ref('silver__msg_attributes') }}
|
||||
t
|
||||
@ -138,18 +139,18 @@ SELECT
|
||||
t.tx_id,
|
||||
t.tx_status,
|
||||
s.trader,
|
||||
f.swap_from_amount AS swap_from_amount,
|
||||
f.swap_from_currency,
|
||||
f.from_amount AS from_amount,
|
||||
f.from_currency,
|
||||
CASE
|
||||
WHEN f.swap_from_currency LIKE 'gamm/pool/%' THEN 18
|
||||
ELSE f.swap_from_decimal
|
||||
END AS swap_from_decimal,
|
||||
tt.swap_to_amount,
|
||||
tt.swap_to_currency,
|
||||
WHEN f.from_currency LIKE 'gamm/pool/%' THEN 18
|
||||
ELSE f.from_decimal
|
||||
END AS from_decimal,
|
||||
tt.to_amount,
|
||||
tt.to_currency,
|
||||
CASE
|
||||
WHEN tt.swap_to_currency LIKE 'gamm/pool/%' THEN 18
|
||||
ELSE tt.swap_to_decimal
|
||||
END AS swap_to_decimal,
|
||||
WHEN tt.to_currency LIKE 'gamm/pool/%' THEN 18
|
||||
ELSE tt.to_decimal
|
||||
END AS to_decimal,
|
||||
pool_ids,
|
||||
t._ingested_at
|
||||
FROM
|
||||
|
||||
@ -45,26 +45,26 @@ models:
|
||||
description: "{{ doc('trader') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- name: SWAP_FROM_AMOUNT
|
||||
description: "{{ doc('swap_from_amount') }}"
|
||||
- name: FROM_AMOUNT
|
||||
description: "{{ doc('from_amount') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- name: SWAP_FROM_CURRENCY
|
||||
description: "{{ doc('swap_from_currency') }}"
|
||||
- name: FROM_CURRENCY
|
||||
description: "{{ doc('from_currency') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- name: SWAP_FROM_DECIMAL
|
||||
description: "{{ doc('swap_from_decimal') }}"
|
||||
- name: SWAP_TO_AMOUNT
|
||||
description: "{{ doc('swap_to_amount') }}"
|
||||
- name: FROM_DECIMAL
|
||||
description: "{{ doc('from_decimal') }}"
|
||||
- name: TO_AMOUNT
|
||||
description: "{{ doc('to_amount') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- name: SWAP_TO_CURRENCY
|
||||
description: "{{ doc('swap_to_currency') }}"
|
||||
- name: TO_CURRENCY
|
||||
description: "{{ doc('to_currency') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- name: SWAP_TO_DECIMAL
|
||||
description: "{{ doc('swap_to_decimal') }}"
|
||||
- name: TO_DECIMAL
|
||||
description: "{{ doc('to_decimal') }}"
|
||||
- name: _INGESTED_AT
|
||||
description: "{{ doc('ingested_at') }}"
|
||||
tests:
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{{ config(
|
||||
materialized = 'incremental',
|
||||
unique_key = "CONCAT_WS('-', tx_id, msg_index, currency_sent)",
|
||||
unique_key = "CONCAT_WS('-', tx_id, msg_index, currency)",
|
||||
incremental_strategy = 'delete+insert',
|
||||
cluster_by = ['_ingested_at::DATE'],
|
||||
) }}
|
||||
@ -65,12 +65,12 @@ coin_sent_ibc AS (
|
||||
0
|
||||
),
|
||||
TRY_PARSE_JSON(attribute_value):amount
|
||||
) AS amount_sent,
|
||||
) AS amount,
|
||||
COALESCE(
|
||||
RIGHT(attribute_value, LENGTH(attribute_value) - LENGTH(SPLIT_PART(TRIM(REGEXP_REPLACE(attribute_value, '[^[:digit:]]', ' ')), ' ', 0))),
|
||||
TRY_PARSE_JSON(attribute_value)[1]:denom )
|
||||
AS currency_sent,
|
||||
l.raw_metadata [1] :exponent AS currency_sent_decimal
|
||||
AS currency,
|
||||
l.raw_metadata [1] :exponent AS decimal
|
||||
|
||||
FROM {{ ref('silver__msg_attributes') }} a
|
||||
|
||||
@ -194,9 +194,9 @@ osmo_amount AS (
|
||||
),
|
||||
' ',
|
||||
0
|
||||
) AS amount_sent,
|
||||
RIGHT(attribute_value, LENGTH(attribute_value) - LENGTH(SPLIT_PART(TRIM(REGEXP_REPLACE(attribute_value, '[^[:digit:]]', ' ')), ' ', 0))) AS currency_sent,
|
||||
l.raw_metadata [1] :exponent AS currency_sent_decimal
|
||||
) AS amount,
|
||||
RIGHT(attribute_value, LENGTH(attribute_value) - LENGTH(SPLIT_PART(TRIM(REGEXP_REPLACE(attribute_value, '[^[:digit:]]', ' ')), ' ', 0))) AS currency,
|
||||
l.raw_metadata [1] :exponent AS decimal
|
||||
FROM osmo_tx_ids o
|
||||
|
||||
LEFT OUTER JOIN {{ ref('silver__msg_attributes') }} m
|
||||
@ -226,12 +226,13 @@ SELECT
|
||||
blockchain,
|
||||
chain_id,
|
||||
r.tx_id,
|
||||
tx_status,
|
||||
tx_status,
|
||||
'IBC_TRANSFER_OUT' AS transfer_type,
|
||||
r.msg_index,
|
||||
sender,
|
||||
amount_sent,
|
||||
currency_sent,
|
||||
currency_sent_decimal,
|
||||
amount,
|
||||
currency,
|
||||
decimal,
|
||||
receiver,
|
||||
_ingested_at
|
||||
FROM receiver_ibc r
|
||||
@ -258,11 +259,12 @@ SELECT
|
||||
chain_id,
|
||||
r.tx_id,
|
||||
tx_status,
|
||||
'OSMOSIS' AS transfer_type,
|
||||
r.msg_index,
|
||||
sender,
|
||||
amount_sent,
|
||||
currency_sent,
|
||||
currency_sent_decimal,
|
||||
amount,
|
||||
currency,
|
||||
decimal,
|
||||
receiver,
|
||||
_ingested_at
|
||||
FROM osmo_receiver r
|
||||
@ -289,12 +291,13 @@ SELECT
|
||||
m.blockchain,
|
||||
m.chain_id,
|
||||
s.tx_id,
|
||||
tx_status,
|
||||
tx_status,
|
||||
'IBC_TRANSFER_IN' AS transfer_type,
|
||||
m.msg_index,
|
||||
TRY_PARSE_JSON(attribute_value):sender :: STRING AS sender,
|
||||
TRY_PARSE_JSON(attribute_value):amount :: INTEGER AS amount_sent,
|
||||
TRY_PARSE_JSON(attribute_value):denom :: STRING currency_sent,
|
||||
raw_metadata[1]:exponent :: INTEGER AS currency_sent_decimal,
|
||||
TRY_PARSE_JSON(attribute_value):amount :: INTEGER AS amount,
|
||||
TRY_PARSE_JSON(attribute_value):denom :: STRING AS currency,
|
||||
raw_metadata[1]:exponent :: INTEGER AS decimal,
|
||||
TRY_PARSE_JSON(attribute_value):receiver :: STRING AS receiver,
|
||||
m._ingested_at
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ models:
|
||||
combination_of_columns:
|
||||
- TX_ID
|
||||
- MSG_INDEX
|
||||
- CURRENCY_SENT
|
||||
- CURRENCY
|
||||
columns:
|
||||
- name: BLOCK_ID
|
||||
description: "{{ doc('block_id') }}"
|
||||
@ -43,24 +43,32 @@ models:
|
||||
description: "{{ doc('tx_status') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- name: TRANSFER_TYPE
|
||||
description: "{{ doc('transfer_type') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- name: SENDER
|
||||
description: "{{ doc('sender') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- name: AMOUNT_SENT
|
||||
description: "{{ doc('amount_sent') }}"
|
||||
- name: AMOUNT
|
||||
description: "{{ doc('amount') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- name: CURRENCY_SENT
|
||||
description: "{{ doc('currency_sent') }}"
|
||||
- name: CURRENCY
|
||||
description: "{{ doc('currency') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- name: DECIMAL
|
||||
description: "{{ doc('decimal') }}"
|
||||
- name: RECEIVER
|
||||
description: "{{ doc('receiver') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- name: CURRENCY_SENT_DECIMAL
|
||||
description: "{{ doc('swap_from_decimal') }}"
|
||||
- name: _INGESTED_AT
|
||||
description: "{{ doc('ingested_at') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- TIMESTAMP_NTZ
|
||||
- TIMESTAMP_NTZ
|
||||
Loading…
Reference in New Issue
Block a user