topics changes (#330)

* topics changes

* remove tx_succeeded
This commit is contained in:
San Yong 2025-02-18 01:35:59 +08:00 committed by GitHub
parent 2c695fc815
commit 343c4919f0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -18,45 +18,61 @@ WITH base_evt AS (
contract_address,
'across-v3' AS NAME,
event_index,
topics [0] :: STRING AS topic_0,
event_name,
topic_0,
CASE
WHEN topic_0 = '0x32ed1a409ef04c7b0227189c3a103dc5ac10e775a15b785dcc510201f7c25ad3' THEN 'FundsDeposited'
WHEN topic_0 = '0xa123dc29aebf7d0c3322c8eeb5b999e859f39937950ed31056532713d0de396f' THEN 'V3FundsDeposited'
END AS event_name,
topics,
DATA,
regexp_substr_all(SUBSTR(DATA, 3, len(DATA)), '.{64}') AS segmented_data,
TRY_TO_NUMBER(
decoded_log :"depositId" :: STRING
) AS depositId,
decoded_log :"depositor" :: STRING AS depositor,
TRY_TO_NUMBER(
decoded_log :"destinationChainId" :: STRING
utils.udf_hex_to_int(
topics [1] :: STRING
)
) AS destinationChainId,
decoded_log :"message" :: STRING AS message,
TRY_TO_NUMBER(
utils.udf_hex_to_int(
topics [2] :: STRING
)
) AS depositId,
CONCAT('0x', SUBSTR(topics [3] :: STRING, 27, 40)) AS depositor,
CONCAT('0x', SUBSTR(segmented_data [0] :: STRING, 25, 40)) AS inputToken,
CONCAT('0x', SUBSTR(segmented_data [1] :: STRING, 25, 40)) AS outputToken,
TRY_TO_NUMBER(
utils.udf_hex_to_int(
segmented_data [2] :: STRING
)
) AS inputAmount,
TRY_TO_NUMBER(
utils.udf_hex_to_int(
segmented_data [3] :: STRING
)
) AS outputAmount,
TRY_TO_TIMESTAMP(
decoded_log :"quoteTimestamp" :: STRING
utils.udf_hex_to_int(
segmented_data [4] :: STRING
)
) AS quoteTimestamp,
decoded_log :"recipient" :: STRING AS recipient,
TRY_TO_NUMBER(
decoded_log :"relayerFeePct" :: STRING
) AS relayerFeePct,
decoded_log :"exclusiveRelayer" :: STRING AS exclusiveRelayer,
TRY_TO_NUMBER(
decoded_log :"exclusivityDeadline" :: STRING
) AS exclusivityDeadline,
TRY_TO_NUMBER(
decoded_log :"fillDeadline" :: STRING
TRY_TO_TIMESTAMP(
utils.udf_hex_to_int(
segmented_data [5] :: STRING
)
) AS fillDeadline,
TRY_TO_NUMBER(
decoded_log :"inputAmount" :: STRING
) AS inputAmount,
decoded_log :"inputToken" :: STRING AS inputToken,
utils.udf_hex_to_int(
segmented_data [6] :: STRING
)
) AS exclusivityDeadline,
CONCAT('0x', SUBSTR(segmented_data [7] :: STRING, 25, 40)) AS recipient,
CONCAT('0x', SUBSTR(segmented_data [8] :: STRING, 25, 40)) AS exclusiveRelayer,
TRY_TO_NUMBER(
decoded_log :"outputAmount" :: STRING
) AS outputAmount,
decoded_log :"outputToken" :: STRING AS outputToken,
decoded_log AS decoded_flat,
utils.udf_hex_to_int(
segmented_data [9] :: STRING
)
) AS relayerFeePct,
segmented_data [10] :: STRING AS message,
event_removed,
IFF(
tx_succeeded,
'SUCCESS',
'FAIL'
) AS tx_status,
CONCAT(
tx_hash :: STRING,
'-',
@ -64,9 +80,12 @@ WITH base_evt AS (
) AS _log_id,
modified_timestamp AS _inserted_timestamp
FROM
{{ ref('core__ez_decoded_event_logs') }}
{{ ref('core__fact_event_logs') }}
WHERE
topics [0] :: STRING = '0xa123dc29aebf7d0c3322c8eeb5b999e859f39937950ed31056532713d0de396f'
topic_0 IN (
'0x32ed1a409ef04c7b0227189c3a103dc5ac10e775a15b785dcc510201f7c25ad3',
'0xa123dc29aebf7d0c3322c8eeb5b999e859f39937950ed31056532713d0de396f'
)
AND contract_address = '0x6f26bf09b1c792e3228e5467807a900a503c0281'
AND tx_succeeded
@ -91,7 +110,6 @@ SELECT
topic_0,
event_name,
event_removed,
tx_status,
contract_address AS bridge_address,
NAME AS platform,
depositor AS sender,