mirror of
https://github.com/FlipsideCrypto/core-models.git
synced 2026-02-06 14:11:45 +00:00
Merge pull request #127 from FlipsideCrypto/AN-5998/layerzero-core
AN 5998/layerzero core
This commit is contained in:
commit
e6ffdbb02c
@ -1,94 +0,0 @@
|
||||
chain,eid
|
||||
Ape,30312
|
||||
Arbitrum,30110
|
||||
Arbitrum Nova,30175
|
||||
Astar,30210
|
||||
Astar zkEVM,30257
|
||||
Avalanche,30106
|
||||
Base,30184
|
||||
Bevm,30317
|
||||
Binance Smart Chain,30102
|
||||
Bitlayer,30314
|
||||
Blast,30243
|
||||
Bob,30279
|
||||
Canto,30159
|
||||
Celo,30125
|
||||
Codex,30323
|
||||
Conflux eSpace,30212
|
||||
Core Blockchain,30153
|
||||
Cyber,30283
|
||||
DOS Chain,30149
|
||||
DeFi Kingdoms,30115
|
||||
Degen,30267
|
||||
Dexalot Subnet,30118
|
||||
Dm2verse,30315
|
||||
EBI,30282
|
||||
Edu,30328
|
||||
Ethereum,30101
|
||||
Etherlink,30292
|
||||
Fantom,30112
|
||||
Flare,30295
|
||||
Fraxtal,30255
|
||||
Fuse,30138
|
||||
Gnosis,30145
|
||||
Gravity,30294
|
||||
Harmony,30116
|
||||
Hedera,30316
|
||||
Hemi,30329
|
||||
Homeverse,30265
|
||||
Horizen EON,30215
|
||||
Hubble,30182
|
||||
Iota,30284
|
||||
Japan Open Chain,30285
|
||||
Kaia,30150
|
||||
Kava,30177
|
||||
Lightlink,30309
|
||||
Linea,30183
|
||||
Lisk,30321
|
||||
Loot,30197
|
||||
Lyra,30311
|
||||
Manta,30217
|
||||
Mantle,30181
|
||||
Masa,30263
|
||||
Meritcircle,30198
|
||||
Merlin,30266
|
||||
Meter,30176
|
||||
Metis,30151
|
||||
Mode,30260
|
||||
Moonbeam,30126
|
||||
Moonriver,30167
|
||||
Morph,30322
|
||||
Near Aurora,30211
|
||||
OKXChain,30155
|
||||
Optimism,30111
|
||||
Orderly,30213
|
||||
Peaq,30302
|
||||
Polygon,30109
|
||||
Polygon zkEVM,30158
|
||||
Rari Chain,30235
|
||||
Reya,30313
|
||||
Sanko,30278
|
||||
Scroll,30214
|
||||
Sei,30280
|
||||
Shimmer,30230
|
||||
Skale,30273
|
||||
Solana,30168
|
||||
Superposition,30327
|
||||
Taiko,30290
|
||||
TelosEVM,30199
|
||||
Tenet,30173
|
||||
Tiltyard,30238
|
||||
Tron,30420
|
||||
Viction,30196
|
||||
Worldchain,30319
|
||||
X Layer,30274
|
||||
XChain,30291
|
||||
XPLA,30216
|
||||
Xai,30236
|
||||
Zircuit,30303
|
||||
Zora,30195
|
||||
inEVM,30234
|
||||
opBNB,30202
|
||||
re.al,30237
|
||||
zkLink,30301
|
||||
zkSync Era,30165
|
||||
|
@ -97,6 +97,10 @@ models:
|
||||
+enabled: false
|
||||
stats:
|
||||
+enabled: true
|
||||
defi:
|
||||
+enabled: false
|
||||
bridge:
|
||||
+enabled: true
|
||||
balances_package:
|
||||
+enabled: true
|
||||
scores_package:
|
||||
|
||||
@ -2,8 +2,12 @@
|
||||
materialized = 'view',
|
||||
persist_docs ={ "relation": true,
|
||||
"columns": true },
|
||||
meta ={ 'database_tags':{ 'table':{ 'PROTOCOL': 'MESON, STARGATE, SYMBIOSIS, GASZIP, COREBRIDGE, GASZIP',
|
||||
'PURPOSE': 'BRIDGE' }} },
|
||||
meta ={
|
||||
'database_tags':{
|
||||
'table':{
|
||||
'PROTOCOL': 'MESON, STARGATE, SYMBIOSIS, GASZIP, COREBRIDGE, GASZIP, LAYERZERO',
|
||||
'PURPOSE': 'BRIDGE'
|
||||
} } },
|
||||
tags = ['gold','defi','bridge','curated','ez']
|
||||
) }}
|
||||
|
||||
@ -22,7 +26,7 @@ SELECT
|
||||
receiver,
|
||||
destination_chain_receiver,
|
||||
COALESCE(
|
||||
standard_destination_chain,
|
||||
c.standardized_name,
|
||||
b.destination_chain
|
||||
) AS destination_chain,
|
||||
destination_chain_id,
|
||||
@ -37,6 +41,7 @@ SELECT
|
||||
END,
|
||||
2
|
||||
) AS amount_usd,
|
||||
token_is_verified,
|
||||
{{ dbt_utils.generate_surrogate_key(
|
||||
['_id']
|
||||
) }} AS ez_bridge_activity_id,
|
||||
@ -45,5 +50,5 @@ SELECT
|
||||
FROM
|
||||
{{ ref('silver_bridge__complete_bridge_activity') }}
|
||||
b
|
||||
LEFT JOIN {{ ref('silver_bridge__standard_dst_chain_seed') }} C
|
||||
ON b.destination_chain = C.destination_chain
|
||||
LEFT JOIN {{ ref('silver_bridge__standard_chain_seed') }} C
|
||||
ON b.destination_chain = C.variation
|
||||
|
||||
@ -46,6 +46,8 @@ models:
|
||||
description: '{{ doc("evm_bridge_amount") }}'
|
||||
- name: AMOUNT_USD
|
||||
description: '{{ doc("evm_bridge_amount_usd") }}'
|
||||
- name: TOKEN_IS_VERIFIED
|
||||
description: '{{ doc("evm_prices_is_verified") }}'
|
||||
- name: EZ_BRIDGE_ACTIVITY_ID
|
||||
description: '{{ doc("evm_pk") }}'
|
||||
- name: INSERTED_TIMESTAMP
|
||||
|
||||
@ -6,7 +6,8 @@
|
||||
tags = ['silver_bridge','defi','bridge','curated']
|
||||
) }}
|
||||
|
||||
WITH senddeposits AS ( -- gaszip lz v2 event (only 1 per tx)
|
||||
WITH senddeposits AS (
|
||||
-- gaszip lz v2 event (only 1 per tx)
|
||||
|
||||
SELECT
|
||||
block_number,
|
||||
@ -40,7 +41,8 @@ AND _inserted_timestamp >= (
|
||||
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
|
||||
{% endif %}
|
||||
),
|
||||
packetsent AS ( -- pulls lz packetsent events from gaszip txs only (1 packet per chain, may have >1 per tx)
|
||||
packetsent AS (
|
||||
-- pulls lz packetsent events from gaszip txs only (1 packet per chain, may have >1 per tx)
|
||||
SELECT
|
||||
tx_hash,
|
||||
event_index,
|
||||
@ -81,7 +83,8 @@ AND modified_timestamp >= (
|
||||
AND modified_timestamp >= SYSDATE() - INTERVAL '7 day'
|
||||
{% endif %}
|
||||
),
|
||||
nativetransfers AS ( -- pulls native transfers in gaszip lz v2 bridging
|
||||
nativetransfers AS (
|
||||
-- pulls native transfers in gaszip lz v2 bridging
|
||||
SELECT
|
||||
tx_hash,
|
||||
TRY_TO_NUMBER(amount_precise_raw) AS amount_precise_raw,
|
||||
@ -121,7 +124,8 @@ SELECT
|
||||
origin_to_address,
|
||||
origin_function_signature,
|
||||
s.tx_hash,
|
||||
p.event_index, -- joins on packetsent event index instead of senddeposits for uniqueness
|
||||
p.event_index,
|
||||
-- joins on packetsent event index instead of senddeposits for uniqueness
|
||||
'SendDeposit' AS event_name,
|
||||
'gaszip-lz-v2' AS platform,
|
||||
'v2' AS version,
|
||||
@ -148,5 +152,5 @@ FROM
|
||||
LEFT JOIN nativetransfers t
|
||||
ON p.tx_hash = t.tx_hash
|
||||
AND event_rank = transfer_rank
|
||||
LEFT JOIN {{ ref('silver_bridge__layerzero_bridge_seed') }}
|
||||
LEFT JOIN {{ ref('silver_bridge__layerzero_v2_bridge_seed') }}
|
||||
ON dstEid = eid
|
||||
|
||||
@ -81,6 +81,44 @@ WHERE
|
||||
)
|
||||
{% endif %}
|
||||
),
|
||||
|
||||
layerzero_v2 AS (
|
||||
SELECT
|
||||
block_number,
|
||||
block_timestamp,
|
||||
origin_from_address,
|
||||
origin_to_address,
|
||||
origin_function_signature,
|
||||
tx_hash,
|
||||
event_index,
|
||||
bridge_address,
|
||||
event_name,
|
||||
platform,
|
||||
version,
|
||||
sender,
|
||||
receiver,
|
||||
destination_chain_receiver,
|
||||
destination_chain_id :: STRING AS destination_chain_id,
|
||||
destination_chain,
|
||||
token_address,
|
||||
NULL AS token_symbol,
|
||||
amount_unadj,
|
||||
_log_id AS _id,
|
||||
inserted_timestamp AS _inserted_timestamp
|
||||
FROM
|
||||
{{ ref('silver_bridge__layerzero_v2') }}
|
||||
|
||||
{% if is_incremental() and 'layerzero_v2' not in var('HEAL_MODELS') %}
|
||||
WHERE
|
||||
_inserted_timestamp >= (
|
||||
SELECT
|
||||
MAX(_inserted_timestamp) - INTERVAL '{{ var("LOOKBACK", "4 hours") }}'
|
||||
FROM
|
||||
{{ this }}
|
||||
)
|
||||
{% endif %}
|
||||
),
|
||||
|
||||
meson AS (
|
||||
SELECT
|
||||
block_number,
|
||||
@ -129,7 +167,7 @@ stargate_v2 AS (
|
||||
bridge_address,
|
||||
event_name,
|
||||
platform,
|
||||
'v2' AS version,
|
||||
version,
|
||||
sender,
|
||||
receiver,
|
||||
destination_chain_receiver,
|
||||
@ -139,9 +177,9 @@ stargate_v2 AS (
|
||||
NULL AS token_symbol,
|
||||
amount_unadj,
|
||||
_log_id AS _id,
|
||||
_inserted_timestamp
|
||||
inserted_timestamp AS _inserted_timestamp
|
||||
FROM
|
||||
{{ ref('silver_bridge__stargate_v2_oftsent') }}
|
||||
{{ ref('silver_bridge__stargate_v2') }}
|
||||
|
||||
{% if is_incremental() and 'stargate_v2' not in var('HEAL_MODELS') %}
|
||||
WHERE
|
||||
@ -200,6 +238,11 @@ all_protocols AS (
|
||||
FROM
|
||||
gaszip_lz
|
||||
UNION ALL
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
layerzero_v2
|
||||
UNION ALL
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
@ -238,9 +281,10 @@ complete_bridge_activity AS (
|
||||
version
|
||||
) IN (
|
||||
'meson-v1',
|
||||
'stargate-v2-v2',
|
||||
'gaszip-lz-v2-v2',
|
||||
'core-bridge-v1'
|
||||
'core-bridge-v1',
|
||||
'layerzero-v2',
|
||||
'stargate-v2'
|
||||
) THEN destination_chain_id :: STRING
|
||||
WHEN d.chain_id IS NULL THEN destination_chain_id :: STRING
|
||||
ELSE d.chain_id :: STRING
|
||||
@ -252,9 +296,10 @@ complete_bridge_activity AS (
|
||||
version
|
||||
) IN (
|
||||
'meson-v1',
|
||||
'stargate-v2-v2',
|
||||
'gaszip-lz-v2-v2',
|
||||
'core-bridge-v1'
|
||||
'core-bridge-v1',
|
||||
'layerzero-v2',
|
||||
'stargate-v2'
|
||||
) THEN LOWER(destination_chain)
|
||||
WHEN d.chain IS NULL THEN LOWER(destination_chain)
|
||||
ELSE LOWER(
|
||||
@ -282,6 +327,7 @@ complete_bridge_activity AS (
|
||||
)
|
||||
ELSE NULL
|
||||
END AS amount_usd,
|
||||
p.is_verified as token_is_verified,
|
||||
_id,
|
||||
b._inserted_timestamp
|
||||
FROM
|
||||
@ -341,6 +387,7 @@ heal_model AS (
|
||||
WHEN C.token_decimals IS NOT NULL THEN amount_heal * p.price
|
||||
ELSE NULL
|
||||
END AS amount_usd_heal,
|
||||
p.is_verified as token_is_verified,
|
||||
_id,
|
||||
t0._inserted_timestamp
|
||||
FROM
|
||||
@ -478,6 +525,7 @@ SELECT
|
||||
amount_unadj,
|
||||
amount_heal AS amount,
|
||||
amount_usd_heal AS amount_usd,
|
||||
token_is_verified,
|
||||
_id,
|
||||
_inserted_timestamp
|
||||
FROM
|
||||
@ -507,6 +555,7 @@ SELECT
|
||||
amount_unadj,
|
||||
amount,
|
||||
amount_usd,
|
||||
token_is_verified,
|
||||
_id,
|
||||
_inserted_timestamp,
|
||||
{{ dbt_utils.generate_surrogate_key(
|
||||
|
||||
@ -1,198 +0,0 @@
|
||||
{{ config(
|
||||
materialized = 'incremental',
|
||||
incremental_strategy = 'delete+insert',
|
||||
unique_key = "block_number",
|
||||
cluster_by = ['block_timestamp::DATE'],
|
||||
tags = ['silver_bridge','defi','bridge','curated']
|
||||
) }}
|
||||
|
||||
WITH stargate_contracts AS (
|
||||
SELECT
|
||||
pool_address,
|
||||
token_address,
|
||||
decimals,
|
||||
shared_decimals,
|
||||
endpoint,
|
||||
owner,
|
||||
token_name,
|
||||
token_symbol
|
||||
FROM
|
||||
{{ ref('silver_bridge__stargate_v2_pools') }}
|
||||
),
|
||||
oft_sent AS (
|
||||
-- bridging transactions from stargate v2 only
|
||||
SELECT
|
||||
block_number,
|
||||
block_timestamp,
|
||||
tx_hash,
|
||||
origin_function_signature,
|
||||
origin_from_address,
|
||||
origin_to_address,
|
||||
contract_address,
|
||||
event_index,
|
||||
'OFTSent' AS event_name,
|
||||
'stargate-v2' AS platform,
|
||||
topic_1 AS guid,
|
||||
CONCAT('0x', SUBSTR(topic_2, 27, 40)) AS from_address,
|
||||
regexp_substr_all(SUBSTR(DATA, 3, len(DATA)), '.{64}') AS segmented_data,
|
||||
TRY_TO_NUMBER(utils.udf_hex_to_int(segmented_data [0] :: STRING)) AS dstEid,
|
||||
TRY_TO_NUMBER(utils.udf_hex_to_int(segmented_data [1] :: STRING)) AS amountsentld,
|
||||
TRY_TO_NUMBER(utils.udf_hex_to_int(segmented_data [2] :: STRING)) AS amountreceivedld,
|
||||
token_address,
|
||||
CONCAT(
|
||||
tx_hash :: STRING,
|
||||
'-',
|
||||
event_index :: STRING
|
||||
) AS _log_id,
|
||||
modified_timestamp AS _inserted_timestamp
|
||||
FROM
|
||||
{{ ref('core__fact_event_logs') }}
|
||||
e
|
||||
INNER JOIN stargate_contracts on contract_address = pool_address
|
||||
WHERE
|
||||
topics [0] = '0x85496b760a4b7f8d66384b9df21b381f5d1b1e79f229a47aaf4c232edc2fe59a'
|
||||
AND tx_succeeded
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _inserted_timestamp >= (
|
||||
SELECT
|
||||
MAX(_inserted_timestamp) - INTERVAL '12 hours'
|
||||
FROM
|
||||
{{ this }}
|
||||
)
|
||||
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
|
||||
{% endif %}
|
||||
),
|
||||
bus_mode AS (
|
||||
SELECT
|
||||
tx_hash,
|
||||
regexp_substr_all(SUBSTR(DATA, 3, len(DATA)), '.{64}') AS segmented_data,
|
||||
TRY_TO_NUMBER(
|
||||
utils.udf_hex_to_int(
|
||||
segmented_data [0] :: STRING
|
||||
)
|
||||
) AS dst_eid,
|
||||
TRY_TO_NUMBER(
|
||||
utils.udf_hex_to_int(
|
||||
segmented_data [1] :: STRING
|
||||
)
|
||||
) AS ticket,
|
||||
TRY_TO_NUMBER(
|
||||
utils.udf_hex_to_int(
|
||||
segmented_data [2] :: STRING
|
||||
)
|
||||
) AS fare,
|
||||
SUBSTR(
|
||||
DATA,
|
||||
3 + 64 * 5,
|
||||
128
|
||||
) AS passenger,
|
||||
TRY_TO_NUMBER(utils.udf_hex_to_int(SUBSTR(passenger, 3, 4))) AS asset_id,
|
||||
CONCAT('0x', SUBSTR(passenger, 3 + 4 + 24, 40)) AS receiver
|
||||
FROM
|
||||
{{ ref('core__fact_event_logs') }}
|
||||
WHERE
|
||||
contract_address = LOWER('0xaf54be5b6eec24d6bfacf1cce4eaf680a8239398') -- tokenmessaging
|
||||
AND topics [0] = '0x15955c5a4cc61b8fbb05301bce47fd31c0e6f935e1ab97fdac9b134c887bb074' -- BusRode
|
||||
AND tx_hash IN (
|
||||
SELECT
|
||||
tx_hash
|
||||
FROM
|
||||
oft_sent
|
||||
)
|
||||
AND tx_succeeded
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND modified_timestamp >= (
|
||||
SELECT
|
||||
MAX(_inserted_timestamp) - INTERVAL '12 hours'
|
||||
FROM
|
||||
{{ this }}
|
||||
)
|
||||
AND modified_timestamp >= SYSDATE() - INTERVAL '7 day'
|
||||
{% endif %}
|
||||
),
|
||||
taxi_mode AS (
|
||||
SELECT
|
||||
tx_hash,
|
||||
input,
|
||||
SUBSTR(input, 11, len(input)),
|
||||
regexp_substr_all(SUBSTR(input, 11, len(input)), '.{64}') AS segmented_data,
|
||||
CONCAT('0x', SUBSTR(segmented_data [4] :: STRING, 25, 40)) AS sender,
|
||||
TRY_TO_NUMBER(utils.udf_hex_to_int(segmented_data [5] :: STRING)) AS dstEid,
|
||||
CONCAT('0x', SUBSTR(segmented_data [6] :: STRING, 25, 40)) AS receiver,
|
||||
TRY_TO_NUMBER(utils.udf_hex_to_int(segmented_data [7] :: STRING)) AS amountSD
|
||||
FROM
|
||||
{{ ref('core__fact_traces') }}
|
||||
WHERE
|
||||
to_address = '0xaf54be5b6eec24d6bfacf1cce4eaf680a8239398' -- tokenmessaging
|
||||
AND from_address IN (
|
||||
SELECT
|
||||
pool_address
|
||||
FROM
|
||||
stargate_contracts
|
||||
)
|
||||
AND tx_hash IN (
|
||||
SELECT
|
||||
tx_hash
|
||||
FROM
|
||||
oft_sent
|
||||
)
|
||||
AND LEFT(
|
||||
input,
|
||||
10
|
||||
) = '0xff6fb300'
|
||||
AND trace_succeeded
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND modified_timestamp >= (
|
||||
SELECT
|
||||
MAX(_inserted_timestamp) - INTERVAL '12 hours'
|
||||
FROM
|
||||
{{ this }}
|
||||
)
|
||||
AND modified_timestamp >= SYSDATE() - INTERVAL '7 day'
|
||||
{% endif %}
|
||||
),
|
||||
bridge_mode AS (
|
||||
SELECT
|
||||
receiver,
|
||||
tx_hash
|
||||
FROM
|
||||
bus_mode
|
||||
UNION ALL
|
||||
SELECT
|
||||
receiver,
|
||||
tx_hash
|
||||
FROM
|
||||
taxi_mode
|
||||
)
|
||||
SELECT
|
||||
block_number,
|
||||
b.block_timestamp,
|
||||
b.tx_hash,
|
||||
origin_function_signature,
|
||||
origin_from_address,
|
||||
origin_to_address,
|
||||
'0x1a44076050125825900e736c501f859c50fe728c' AS bridge_address,
|
||||
event_index,
|
||||
event_name,
|
||||
platform,
|
||||
origin_from_address AS sender,
|
||||
receiver,
|
||||
receiver AS destination_chain_receiver,
|
||||
amountSentLD AS amount_unadj,
|
||||
b.dstEid AS destination_chain_id,
|
||||
LOWER(
|
||||
s.chain :: STRING
|
||||
) AS destination_chain,
|
||||
token_address,
|
||||
_log_id,
|
||||
b._inserted_timestamp
|
||||
FROM
|
||||
oft_sent b
|
||||
LEFT JOIN bridge_mode m
|
||||
ON m.tx_hash = b.tx_hash
|
||||
INNER JOIN {{ ref('silver_bridge__layerzero_bridge_seed') }}
|
||||
s
|
||||
ON b.dstEid :: STRING = s.eid :: STRING
|
||||
@ -1,50 +0,0 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: silver_bridge__stargate_v2_oftsent
|
||||
tests:
|
||||
- dbt_utils.unique_combination_of_columns:
|
||||
combination_of_columns:
|
||||
- _LOG_ID
|
||||
columns:
|
||||
- name: BLOCK_NUMBER
|
||||
tests:
|
||||
- not_null
|
||||
- name: BLOCK_TIMESTAMP
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- TIMESTAMP_LTZ
|
||||
- TIMESTAMP_NTZ
|
||||
- name: TX_HASH
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_match_regex:
|
||||
regex: 0[xX][0-9a-fA-F]+
|
||||
- name: TOKEN_ADDRESS
|
||||
tests:
|
||||
- not_null
|
||||
- name: SENDER
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_match_regex:
|
||||
regex: 0[xX][0-9a-fA-F]+
|
||||
- name: DESTINATION_CHAIN_RECEIVER
|
||||
tests:
|
||||
- not_null
|
||||
- name: BRIDGE_ADDRESS
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_match_regex:
|
||||
regex: 0[xX][0-9a-fA-F]+
|
||||
- name: AMOUNT_UNADJ
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- DECIMAL
|
||||
- FLOAT
|
||||
- NUMBER
|
||||
- name: _INSERTED_TIMESTAMP
|
||||
tests:
|
||||
- not_null
|
||||
@ -1,93 +0,0 @@
|
||||
{{ config(
|
||||
materialized = 'incremental',
|
||||
incremental_strategy = 'delete+insert',
|
||||
unique_key = "block_number",
|
||||
tags = ['silver_bridge','defi','bridge','curated']
|
||||
) }}
|
||||
|
||||
WITH base_contracts AS (
|
||||
|
||||
SELECT
|
||||
block_number,
|
||||
block_timestamp,
|
||||
tx_hash,
|
||||
to_address AS contract_address,
|
||||
POSITION(
|
||||
'00000000000000000000000000000000000000000000000000000000000000e0',
|
||||
input,
|
||||
LENGTH(input) - 703
|
||||
) AS argument_start,
|
||||
-- starting position of arguments
|
||||
SUBSTR(input, argument_start, LENGTH(input) - argument_start + 1) AS arguments,
|
||||
regexp_SUBSTR_all(SUBSTR(arguments, 0, len(arguments)), '.{64}') AS segmented_arguments,
|
||||
ARRAY_SIZE(segmented_arguments) AS data_size,
|
||||
CONCAT(
|
||||
'0x',
|
||||
SUBSTR(
|
||||
segmented_arguments [2] :: STRING,
|
||||
25,
|
||||
40
|
||||
)
|
||||
) AS token_address,
|
||||
utils.udf_hex_to_int(
|
||||
segmented_arguments [data_size-8] :: STRING
|
||||
) AS decimals,
|
||||
utils.udf_hex_to_int(
|
||||
segmented_arguments [data_size-7] :: STRING
|
||||
) AS shared_decimals,
|
||||
CONCAT(
|
||||
'0x',
|
||||
SUBSTR(
|
||||
segmented_arguments [data_size-6] :: STRING,
|
||||
25,
|
||||
40
|
||||
)
|
||||
) AS endpoint,
|
||||
CONCAT(
|
||||
'0x',
|
||||
SUBSTR(
|
||||
segmented_arguments [data_size-5] :: STRING,
|
||||
25,
|
||||
40
|
||||
)
|
||||
) AS owner,
|
||||
utils.udf_hex_to_string(
|
||||
segmented_arguments [data_size-3] :: STRING
|
||||
) AS token_name,
|
||||
utils.udf_hex_to_string(
|
||||
segmented_arguments [data_size-1] :: STRING
|
||||
) AS token_symbol,
|
||||
modified_timestamp AS _inserted_timestamp
|
||||
FROM
|
||||
{{ ref('core__fact_traces') }}
|
||||
WHERE
|
||||
origin_function_signature = '0x61014060'
|
||||
AND from_address = '0x1d7c6783328c145393e84fb47a7f7c548f5ee28d'
|
||||
AND trace_succeeded
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _inserted_timestamp >= (
|
||||
SELECT
|
||||
MAX(_inserted_timestamp) - INTERVAL '12 hours'
|
||||
FROM
|
||||
{{ this }}
|
||||
)
|
||||
AND _inserted_timestamp >= SYSDATE() - INTERVAL '7 day'
|
||||
{% endif %}
|
||||
|
||||
)
|
||||
SELECT
|
||||
block_number,
|
||||
block_timestamp,
|
||||
tx_hash,
|
||||
contract_address as pool_address,
|
||||
token_address,
|
||||
decimals,
|
||||
shared_decimals,
|
||||
endpoint,
|
||||
owner,
|
||||
token_name,
|
||||
token_symbol,
|
||||
_inserted_timestamp
|
||||
FROM
|
||||
base_contracts
|
||||
@ -1,16 +0,0 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: silver_bridge__stargate_v2_pools
|
||||
tests:
|
||||
- dbt_utils.unique_combination_of_columns:
|
||||
combination_of_columns:
|
||||
- POOL_ADDRESS
|
||||
columns:
|
||||
- name: BLOCK_NUMBER
|
||||
tests:
|
||||
- not_null
|
||||
- name: TOKEN_ADDRESS
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_match_regex:
|
||||
regex: 0[xX][0-9a-fA-F]+
|
||||
@ -1,3 +1,3 @@
|
||||
packages:
|
||||
- git: https://github.com/FlipsideCrypto/fsc-evm.git
|
||||
revision: v4.4.0
|
||||
revision: v4.5.0
|
||||
Loading…
Reference in New Issue
Block a user