From 2de4e9e48c37076824ce2fd2f0dc5db4d0bb706b Mon Sep 17 00:00:00 2001 From: San Yong <22216004+SanYongxie@users.noreply.github.com> Date: Thu, 5 Jun 2025 23:13:14 +0800 Subject: [PATCH] Fix/cctpv2-address (#322) * update seed * update address logic --- data/silver_bridge__cctp_chain_id_seed.csv | 5 +- .../silver_bridge__cctp_v2_depositforburn.sql | 82 ++++++------------- 2 files changed, 31 insertions(+), 56 deletions(-) diff --git a/data/silver_bridge__cctp_chain_id_seed.csv b/data/silver_bridge__cctp_chain_id_seed.csv index 02e62b0..b5fec61 100644 --- a/data/silver_bridge__cctp_chain_id_seed.csv +++ b/data/silver_bridge__cctp_chain_id_seed.csv @@ -9,4 +9,7 @@ base,6 polygon pos,7 sui,8 aptos,9 -unichain,10 \ No newline at end of file +unichain,10 +linea,11 +sonic,13 +worldchain,14 \ No newline at end of file diff --git a/models/silver/defi/bridge/cctp/silver_bridge__cctp_v2_depositforburn.sql b/models/silver/defi/bridge/cctp/silver_bridge__cctp_v2_depositforburn.sql index 5ce4178..0138f91 100644 --- a/models/silver/defi/bridge/cctp/silver_bridge__cctp_v2_depositforburn.sql +++ b/models/silver/defi/bridge/cctp/silver_bridge__cctp_v2_depositforburn.sql @@ -33,83 +33,55 @@ WITH base_evt AS ( decoded_log :destinationDomain :: STRING ) AS destination_domain, CASE - WHEN destination_domain IN ( - 0, - 1, - 2, - 3, - 6, - 7, - 10 - ) THEN CONCAT( + WHEN destination_domain = 5 THEN utils.udf_hex_to_base58( + decoded_log :mintRecipient :: STRING + ) -- solana + WHEN LEFT( + decoded_log :mintRecipient :: STRING, + 26 + ) = '0x000000000000000000000000' THEN CONCAT( '0x', SUBSTR( decoded_log :mintRecipient :: STRING, - 25, + 27, 40 ) ) -- evm - WHEN destination_domain = 5 THEN utils.udf_hex_to_base58(CONCAT('0x', decoded_log :mintRecipient :: STRING)) -- solana - ELSE CONCAT( - '0x', - decoded_log :mintRecipient :: STRING - ) -- other non-evm chains + ELSE decoded_log :mintRecipient :: STRING -- other non-evm chains END AS mint_recipient, CASE - WHEN destination_domain IN ( - 0, - 1, - 2, - 3, - 6, - 7, - 10 - ) THEN CONCAT( + WHEN destination_domain = 5 THEN utils.udf_hex_to_base58( + decoded_log :destinationTokenMessenger :: STRING + ) -- solana + WHEN LEFT( + decoded_log :destinationTokenMessenger :: STRING, + 26 + ) = '0x000000000000000000000000' THEN CONCAT( '0x', SUBSTR( decoded_log :destinationTokenMessenger :: STRING, - 25, + 27, 40 ) ) -- evm - WHEN destination_domain = 5 THEN utils.udf_hex_to_base58( - CONCAT( - '0x', - decoded_log :destinationTokenMessenger :: STRING - ) - ) -- solana - ELSE CONCAT( - '0x', - decoded_log :destinationTokenMessenger :: STRING - ) -- other non-evm chains + ELSE decoded_log :destinationTokenMessenger :: STRING -- other non-evm chains END AS destination_token_messenger, CASE - WHEN destination_domain IN ( - 0, - 1, - 2, - 3, - 6, - 7, - 10 - ) THEN CONCAT( + WHEN destination_domain = 5 THEN utils.udf_hex_to_base58( + decoded_log :destinationCaller :: STRING + ) -- solana + WHEN LEFT( + decoded_log :destinationCaller :: STRING, + 26 + ) = '0x000000000000000000000000' THEN CONCAT( '0x', SUBSTR( decoded_log :destinationCaller :: STRING, - 25, + 27, 40 ) ) -- evm - WHEN destination_domain = 5 THEN utils.udf_hex_to_base58( - CONCAT( - '0x', - decoded_log :destinationCaller :: STRING - ) - ) -- solana - ELSE CONCAT( - '0x', - decoded_log :destinationCaller :: STRING - ) -- other non-evm chains + ELSE decoded_log :destinationCaller :: STRING -- other non-evm chains END AS destination_caller, modified_timestamp, CONCAT(