mirror of
https://github.com/FlipsideCrypto/base-models.git
synced 2026-02-06 17:36:52 +00:00
add (#331)
This commit is contained in:
parent
bc5b6f4b43
commit
a658e9fad5
@ -102,6 +102,10 @@ models:
|
||||
+enabled: false
|
||||
stats:
|
||||
+enabled: true
|
||||
defi:
|
||||
+enabled: false
|
||||
bridge:
|
||||
+enabled: true
|
||||
scores_package:
|
||||
+enabled: true
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ SELECT
|
||||
receiver,
|
||||
destination_chain_receiver,
|
||||
COALESCE(
|
||||
standard_destination_chain,
|
||||
c.standardized_name,
|
||||
b.destination_chain
|
||||
) AS destination_chain,
|
||||
destination_chain_id,
|
||||
@ -37,6 +37,7 @@ SELECT
|
||||
END,
|
||||
2
|
||||
) AS amount_usd,
|
||||
token_is_verified,
|
||||
COALESCE (
|
||||
complete_bridge_activity_id,
|
||||
{{ dbt_utils.generate_surrogate_key(
|
||||
@ -54,5 +55,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
|
||||
|
||||
@ -261,6 +261,42 @@ 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,
|
||||
@ -333,6 +369,42 @@ WHERE
|
||||
)
|
||||
{% endif %}
|
||||
),
|
||||
stargate_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__stargate_v2') }}
|
||||
|
||||
{% if is_incremental() and 'stargate_v2' not in var('HEAL_MODELS') %}
|
||||
WHERE
|
||||
_inserted_timestamp >= (
|
||||
SELECT
|
||||
MAX(_inserted_timestamp) - INTERVAL '{{ var("LOOKBACK", "4 hours") }}'
|
||||
FROM
|
||||
{{ this }}
|
||||
)
|
||||
{% endif %}
|
||||
),
|
||||
symbiosis AS (
|
||||
SELECT
|
||||
block_number,
|
||||
@ -621,6 +693,11 @@ all_protocols AS (
|
||||
FROM
|
||||
hop
|
||||
UNION ALL
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
layerzero_v2
|
||||
UNION ALL
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
@ -631,6 +708,11 @@ all_protocols AS (
|
||||
FROM
|
||||
stargate
|
||||
UNION ALL
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
stargate_v2
|
||||
UNION ALL
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
@ -694,7 +776,9 @@ complete_bridge_activity AS (
|
||||
'allbridge-v2',
|
||||
'circle-cctp-v1',
|
||||
'circle-cctp-v2-v2',
|
||||
'chainlink-ccip-v1'
|
||||
'chainlink-ccip-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
|
||||
@ -711,7 +795,9 @@ complete_bridge_activity AS (
|
||||
'allbridge-v2',
|
||||
'circle-cctp-v1',
|
||||
'circle-cctp-v2-v2',
|
||||
'chainlink-ccip-v1'
|
||||
'chainlink-ccip-v1',
|
||||
'layerzero-v2',
|
||||
'stargate-v2'
|
||||
) THEN LOWER(destination_chain)
|
||||
WHEN d.chain IS NULL THEN LOWER(destination_chain)
|
||||
ELSE LOWER(
|
||||
@ -736,6 +822,7 @@ complete_bridge_activity AS (
|
||||
WHEN C.token_decimals IS NOT NULL THEN amount * p.price
|
||||
ELSE NULL
|
||||
END AS amount_usd,
|
||||
p.is_verified AS token_is_verified,
|
||||
_id,
|
||||
b._inserted_timestamp
|
||||
FROM
|
||||
@ -795,6 +882,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
|
||||
@ -932,6 +1020,7 @@ SELECT
|
||||
amount_unadj,
|
||||
amount_heal AS amount,
|
||||
amount_usd_heal AS amount_usd,
|
||||
token_is_verified,
|
||||
_id,
|
||||
_inserted_timestamp
|
||||
FROM
|
||||
@ -961,6 +1050,7 @@ SELECT
|
||||
amount_unadj,
|
||||
amount,
|
||||
amount_usd,
|
||||
token_is_verified,
|
||||
_id,
|
||||
_inserted_timestamp,
|
||||
{{ dbt_utils.generate_surrogate_key(
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
packages:
|
||||
- git: https://github.com/FlipsideCrypto/fsc-evm.git
|
||||
revision: v4.3.0
|
||||
revision: v4.5.0
|
||||
Loading…
Reference in New Issue
Block a user