mirror of
https://github.com/FlipsideCrypto/near-models.git
synced 2026-02-06 15:31:49 +00:00
add ft_transfer_call method, add receipt_succeeded col
This commit is contained in:
parent
8f8052a04a
commit
34e9b4f581
@ -25,7 +25,6 @@ WITH transfers AS (
|
||||
{{ ref('core__ez_actions') }}
|
||||
WHERE
|
||||
action_name = 'FunctionCall'
|
||||
AND receipt_succeeded
|
||||
AND action_data :deposit :: INT > 0
|
||||
|
||||
{% if var("MANUAL_FIX") %}
|
||||
|
||||
@ -28,7 +28,6 @@ WITH transfers AS (
|
||||
{{ ref('core__ez_actions') }}
|
||||
WHERE
|
||||
action_name = 'Transfer'
|
||||
AND receipt_succeeded
|
||||
|
||||
{% if var("MANUAL_FIX") %}
|
||||
AND {{ partition_load_manual('no_buffer') }}
|
||||
|
||||
@ -24,8 +24,7 @@ WITH ft_transfer_logs AS (
|
||||
FROM
|
||||
{{ ref('silver__logs_s3') }}
|
||||
WHERE
|
||||
receipt_succeeded
|
||||
AND is_standard -- Only look at EVENT_JSON formatted logs
|
||||
is_standard -- Only look at EVENT_JSON formatted logs
|
||||
AND try_parse_json(clean_log) :event :: STRING = 'ft_transfer'
|
||||
|
||||
{% if var("MANUAL_FIX") %}
|
||||
@ -62,6 +61,7 @@ ft_transfers_final AS (
|
||||
f.value :amount :: variant AS amount_unadj,
|
||||
f.value :memo :: STRING AS memo,
|
||||
log_index + f.index AS event_index,
|
||||
receipt_succeeded,
|
||||
_partition_by_block_number
|
||||
FROM
|
||||
ft_transfer_logs,
|
||||
@ -84,6 +84,7 @@ SELECT
|
||||
amount_unadj,
|
||||
memo,
|
||||
event_index AS rn,
|
||||
receipt_succeeded,
|
||||
_partition_by_block_number,
|
||||
{{ dbt_utils.generate_surrogate_key(
|
||||
['receipt_id', 'contract_address', 'amount_unadj', 'from_address', 'to_address', 'rn']
|
||||
|
||||
@ -69,6 +69,13 @@ models:
|
||||
- dbt_expectations.expect_column_values_to_be_of_type:
|
||||
column_type: NUMBER
|
||||
|
||||
- name: RECEIPT_SUCCEEDED
|
||||
description: "{{doc('receipt_succeeded')}}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_of_type:
|
||||
column_type: BOOLEAN
|
||||
|
||||
- name: _PARTITION_BY_BLOCK_NUMBER
|
||||
description: "{{doc('_partition_by_block_number')}}"
|
||||
|
||||
|
||||
@ -80,8 +80,7 @@ WITH ft_transfer_actions AS (
|
||||
{{ ref('core__ez_actions') }}
|
||||
WHERE
|
||||
action_name = 'FunctionCall'
|
||||
AND action_data :method_name :: STRING = 'ft_transfer'
|
||||
AND receipt_succeeded
|
||||
AND action_data :method_name :: STRING in ('ft_transfer', 'ft_transfer_call')
|
||||
|
||||
{% if var("MANUAL_FIX") %}
|
||||
AND {{ partition_load_manual('no_buffer') }}
|
||||
@ -104,7 +103,7 @@ logs AS (
|
||||
FROM
|
||||
{{ ref('silver__logs_s3') }}
|
||||
WHERE
|
||||
receipt_succeeded
|
||||
NOT is_standard
|
||||
{% if var("MANUAL_FIX") %}
|
||||
AND
|
||||
{{ partition_load_manual('no_buffer') }}
|
||||
@ -126,7 +125,8 @@ ft_transfer_logs AS (
|
||||
a.contract_address,
|
||||
a.predecessor_id,
|
||||
a.signer_id,
|
||||
a.action_index
|
||||
a.action_index,
|
||||
a.receipt_succeeded
|
||||
FROM
|
||||
logs l
|
||||
INNER JOIN ft_transfer_actions a
|
||||
@ -171,7 +171,8 @@ ft_transfers_final AS (
|
||||
) :: variant AS amount_unadj,
|
||||
'' AS memo,
|
||||
log_index + action_index AS event_index,
|
||||
_partition_by_block_number
|
||||
_partition_by_block_number,
|
||||
receipt_succeeded
|
||||
FROM
|
||||
ft_transfer_logs
|
||||
WHERE
|
||||
@ -193,6 +194,7 @@ SELECT
|
||||
amount_unadj,
|
||||
memo,
|
||||
event_index AS rn,
|
||||
receipt_succeeded,
|
||||
_partition_by_block_number,
|
||||
{{ dbt_utils.generate_surrogate_key(
|
||||
['receipt_id', 'contract_address', 'amount_unadj', 'from_address', 'to_address', 'rn']
|
||||
|
||||
@ -68,6 +68,13 @@ models:
|
||||
- dbt_expectations.expect_column_values_to_be_of_type:
|
||||
column_type: NUMBER
|
||||
|
||||
- name: RECEIPT_SUCCEEDED
|
||||
description: "{{doc('receipt_succeeded')}}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_of_type:
|
||||
column_type: BOOLEAN
|
||||
|
||||
- name: _PARTITION_BY_BLOCK_NUMBER
|
||||
description: "{{doc('_partition_by_block_number')}}"
|
||||
|
||||
|
||||
@ -24,8 +24,7 @@ WITH liquidity_logs AS (
|
||||
FROM
|
||||
{{ ref('silver__logs_s3') }}
|
||||
WHERE
|
||||
receipt_succeeded
|
||||
AND log_index = 0 -- Liquidity logs are always first
|
||||
log_index = 0 -- Liquidity logs are always first
|
||||
AND clean_log :: STRING like 'Liquidity added [%minted % shares'
|
||||
|
||||
{% if var("MANUAL_FIX") %}
|
||||
@ -69,6 +68,7 @@ add_liquidity AS (
|
||||
log_index + INDEX AS event_index,
|
||||
predecessor_id,
|
||||
signer_id,
|
||||
receipt_succeeded,
|
||||
_partition_by_block_number
|
||||
FROM
|
||||
liquidity_logs,
|
||||
@ -95,6 +95,7 @@ SELECT
|
||||
memo,
|
||||
event_index AS rn,
|
||||
predecessor_id,
|
||||
receipt_succeeded,
|
||||
_partition_by_block_number,
|
||||
{{ dbt_utils.generate_surrogate_key(
|
||||
['receipt_id', 'contract_address', 'amount_unadj', 'to_address', 'rn']
|
||||
|
||||
@ -64,6 +64,13 @@ models:
|
||||
- name: PREDECESSOR_ID
|
||||
description: "{{doc('predecessor_id')}}"
|
||||
|
||||
- name: RECEIPT_SUCCEEDED
|
||||
description: "{{doc('receipt_succeeded')}}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_of_type:
|
||||
column_type: BOOLEAN
|
||||
|
||||
- name: _PARTITION_BY_BLOCK_NUMBER
|
||||
description: "{{doc('_partition_by_block_number')}}"
|
||||
|
||||
|
||||
@ -24,8 +24,7 @@ WITH ft_mint_logs AS (
|
||||
FROM
|
||||
{{ ref('silver__logs_s3') }}
|
||||
WHERE
|
||||
receipt_succeeded
|
||||
AND is_standard -- Only look at EVENT_JSON formatted logs
|
||||
is_standard -- Only look at EVENT_JSON formatted logs
|
||||
AND try_parse_json(clean_log) :event :: STRING = 'ft_mint'
|
||||
|
||||
{% if var("MANUAL_FIX") %}
|
||||
@ -61,7 +60,8 @@ ft_mints_final AS (
|
||||
f.value :amount :: variant AS amount_unadj,
|
||||
f.value :memo :: STRING AS memo,
|
||||
log_index + f.index AS event_index,
|
||||
_partition_by_block_number
|
||||
_partition_by_block_number,
|
||||
receipt_succeeded
|
||||
FROM
|
||||
ft_mint_logs,
|
||||
LATERAL FLATTEN(
|
||||
@ -83,6 +83,7 @@ SELECT
|
||||
memo,
|
||||
event_index AS rn,
|
||||
predecessor_id,
|
||||
receipt_succeeded,
|
||||
_partition_by_block_number,
|
||||
{{ dbt_utils.generate_surrogate_key(
|
||||
['receipt_id', 'contract_address', 'amount_unadj', 'to_address', 'rn']
|
||||
|
||||
@ -64,6 +64,13 @@ models:
|
||||
- name: PREDECESSOR_ID
|
||||
description: "{{doc('predecessor_id')}}"
|
||||
|
||||
- name: RECEIPT_SUCCEEDED
|
||||
description: "{{doc('receipt_succeeded')}}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_of_type:
|
||||
column_type: BOOLEAN
|
||||
|
||||
- name: _PARTITION_BY_BLOCK_NUMBER
|
||||
description: "{{doc('_partition_by_block_number')}}"
|
||||
|
||||
|
||||
@ -24,8 +24,7 @@ WITH order_logs AS (
|
||||
FROM
|
||||
{{ ref('silver__logs_s3') }}
|
||||
WHERE
|
||||
receipt_succeeded
|
||||
AND is_standard -- Only look at EVENT_JSON formatted logs
|
||||
is_standard -- Only look at EVENT_JSON formatted logs
|
||||
AND try_parse_json(clean_log) :event :: STRING = 'order_added'
|
||||
|
||||
{% if var("MANUAL_FIX") %}
|
||||
@ -56,7 +55,8 @@ orders_final AS (
|
||||
f.value :original_amount :: variant AS amount_unadj,
|
||||
'order' AS memo,
|
||||
log_index + f.index AS event_index,
|
||||
_partition_by_block_number
|
||||
_partition_by_block_number,
|
||||
receipt_succeeded
|
||||
FROM
|
||||
order_logs,
|
||||
LATERAL FLATTEN(
|
||||
@ -78,6 +78,7 @@ SELECT
|
||||
amount_unadj,
|
||||
memo,
|
||||
event_index AS rn,
|
||||
receipt_succeeded,
|
||||
_partition_by_block_number,
|
||||
{{ dbt_utils.generate_surrogate_key(
|
||||
['receipt_id', 'contract_address', 'amount_unadj', 'from_address', 'to_address', 'rn']
|
||||
|
||||
@ -63,6 +63,13 @@ models:
|
||||
- dbt_expectations.expect_column_values_to_be_of_type:
|
||||
column_type: NUMBER
|
||||
|
||||
- name: RECEIPT_SUCCEEDED
|
||||
description: "{{doc('receipt_succeeded')}}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_of_type:
|
||||
column_type: BOOLEAN
|
||||
|
||||
- name: _PARTITION_BY_BLOCK_NUMBER
|
||||
description: "{{doc('_partition_by_block_number')}}"
|
||||
|
||||
|
||||
@ -25,6 +25,7 @@ WITH actions AS (
|
||||
) :: STRING AS amount_unadj,
|
||||
NULL AS memo,
|
||||
action_index AS rn,
|
||||
receipt_succeeded,
|
||||
FLOOR(
|
||||
block_id,
|
||||
-3
|
||||
@ -68,6 +69,7 @@ SELECT
|
||||
amount_unadj,
|
||||
memo,
|
||||
rn,
|
||||
receipt_succeeded,
|
||||
_partition_by_block_number,
|
||||
{{ dbt_utils.generate_surrogate_key(
|
||||
['receipt_id', 'amount_unadj', 'from_address', 'to_address', 'rn']
|
||||
|
||||
@ -81,6 +81,13 @@ models:
|
||||
- dbt_expectations.expect_column_values_to_be_of_type:
|
||||
column_type: NUMBER
|
||||
|
||||
- name: RECEIPT_SUCCEEDED
|
||||
description: "{{doc('receipt_succeeded')}}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_of_type:
|
||||
column_type: BOOLEAN
|
||||
|
||||
- name: _partition_by_block_number
|
||||
description: The block number used for partitioning
|
||||
tests:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user