deprecate saber

This commit is contained in:
tarikceric 2025-11-04 14:28:46 -08:00
parent 04e65ffe1d
commit 50a191fd13
7 changed files with 107 additions and 53 deletions

View File

@ -337,28 +337,6 @@ FROM
WHERE modified_timestamp >= '{{ max_modified_timestamp }}'
{% endif %}
UNION ALL
SELECT
block_timestamp,
block_id,
tx_id,
succeeded,
swapper,
swap_from_amount,
swap_from_mint,
swap_to_amount,
swap_to_mint,
program_id,
'Saber Stable Swap' as swap_program,
swap_index,
swaps_intermediate_saber_id as fact_swaps_id,
inserted_timestamp,
modified_timestamp
FROM
{{ ref('silver__swaps_intermediate_saber') }}
{% if is_incremental() %}
WHERE modified_timestamp >= '{{ max_modified_timestamp }}'
{% endif %}
UNION ALL
SELECT
block_timestamp,
block_id,
@ -454,6 +432,25 @@ FROM
l
ON s.program_id = l.address
union all
SELECT
block_timestamp,
block_id,
tx_id,
succeeded,
swapper,
swap_from_amount,
swap_from_mint,
swap_to_amount,
swap_to_mint,
program_id,
'Saber Stable Swap' as swap_program,
concat_ws('-',tx_id,swap_index,swap_program) as _log_id,
swaps_intermediate_saber_id as fact_swaps_id,
inserted_timestamp,
modified_timestamp
FROM
{{ ref('silver__swaps_intermediate_saber_view') }}
UNION ALL
{% endif %}
select

View File

@ -3,7 +3,8 @@
unique_key = ["block_id","tx_id","action_index"],
merge_predicates = ["DBT_INTERNAL_DEST.block_timestamp::date >= LEAST(current_date-7,(select min(block_timestamp)::date from {{ this }}__dbt_tmp))"],
cluster_by = ['block_timestamp::DATE','modified_timestamp::DATE'],
tags = ['scheduled_non_core']
full_refresh = false,
enabled = false,
) }}
WITH base_events AS(

View File

@ -0,0 +1,25 @@
{{ config(
materialized = 'view'
) }}
SELECT
block_id,
block_timestamp,
tx_id,
succeeded,
program_id,
action,
liquidity_provider,
liquidity_pool_address,
amount,
mint,
action_index,
_inserted_timestamp,
liquidity_pool_actions_saber_id,
inserted_timestamp,
modified_timestamp
FROM
{{ source(
'solana_silver',
'liquidity_pool_actions_saber'
) }}

View File

@ -217,34 +217,6 @@ WHERE
AND _inserted_timestamp >= '{{ max_inserted_timestamp }}'
{% endif %}
UNION ALL
SELECT
block_timestamp,
block_id,
tx_id,
succeeded,
index,
inner_index,
swap_index,
swapper,
swap_from_amount,
swap_from_mint,
swap_to_amount,
swap_to_mint,
program_id,
_inserted_timestamp,
swaps_intermediate_saber_id as marinade_swaps_id,
inserted_timestamp,
modified_timestamp,
'{{ invocation_id }}' AS invocation_id
FROM
{{ ref('silver__swaps_intermediate_saber') }}
WHERE
(swap_from_mint IN ('{{ MNDE_MINT }}', '{{ MSOL_MINT }}') OR swap_to_mint IN ('{{ MNDE_MINT }}', '{{ MSOL_MINT }}'))
AND succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= '{{ max_inserted_timestamp }}'
{% endif %}
UNION ALL
SELECT
block_timestamp,
block_id,
@ -383,4 +355,32 @@ WHERE
AND succeeded
{% if is_incremental() %}
AND _inserted_timestamp >= '{{ max_inserted_timestamp }}'
{% endif %}
{% endif %}
{% if not is_incremental() %}
-- Only select from the deprecated model during the initial FR
SELECT
block_timestamp,
block_id,
tx_id,
succeeded,
index,
inner_index,
swap_index,
swapper,
swap_from_amount,
swap_from_mint,
swap_to_amount,
swap_to_mint,
program_id,
_inserted_timestamp,
swaps_intermediate_saber_id as marinade_swaps_id,
inserted_timestamp,
modified_timestamp,
'{{ invocation_id }}' AS invocation_id
FROM
{{ ref('silver__swaps_intermediate_saber_view') }}
WHERE
(swap_from_mint IN ('{{ MNDE_MINT }}', '{{ MSOL_MINT }}') OR swap_to_mint IN ('{{ MNDE_MINT }}', '{{ MSOL_MINT }}'))
AND succeeded
{% endif %}

View File

@ -6,7 +6,8 @@
incremental_predicates = ["dynamic_range_predicate", "block_timestamp::date"],
merge_exclude_columns = ["inserted_timestamp"],
cluster_by = ['block_timestamp::DATE','modified_timestamp::DATE'],
tags = ['scheduled_non_core','scheduled_non_core_hourly'],
full_refresh = false,
enabled = false,
) }}
{% if execute %}

View File

@ -0,0 +1,28 @@
{{ config(
materialized = 'view'
) }}
SELECT
block_id,
block_timestamp,
program_id,
tx_id,
succeeded,
swap_index,
index,
inner_index,
swapper,
swap_from_amount,
swap_from_mint,
swap_to_amount,
swap_to_mint,
_inserted_timestamp,
swaps_intermediate_saber_id,
inserted_timestamp,
modified_timestamp,
_invocation_id
FROM
{{ source(
'solana_silver',
'swaps_intermediate_saber'
) }}

View File

@ -120,6 +120,8 @@ sources:
- name: nft_sales_tensorswap_buysellevent
- name: nft_sales_tensorswap
- name: nft_sales_hadeswap_decoded
- name: swaps_intermediate_saber
- name: liquidity_pool_actions_saber
- name: solana_streamline
database: solana
schema: streamline