Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix solana dex.trades issue #7119

Merged
merged 10 commits into from
Nov 8, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@
}}

{% set solana_dexes = [
ref('orca_whirlpool_base_trades')
, ref('orca_whirlpool_v2_base_trades')
, ref('raydium_v3_base_trades')
, ref('raydium_v4_base_trades')
, ref('phoenix_v1_base_trades')
, ref('lifinity_v1_base_trades')
, ref('lifinity_v2_base_trades')
, ref('meteora_v1_solana_base_trades')
, ref('meteora_v2_solana_base_trades')
, ref('goosefx_ssl_v2_solana_base_trades')
, ref('pumpdotfun_solana_base_trades')
ref('raydium_v3_base_trades')
, ref('raydium_v4_base_trades')
, ref('orca_whirlpool_base_trades')
, ref('orca_whirlpool_v2_base_trades')
, ref('phoenix_v1_base_trades')
, ref('lifinity_v1_base_trades')
, ref('lifinity_v2_base_trades')
, ref('meteora_v1_solana_base_trades')
, ref('meteora_v2_solana_base_trades')
, ref('goosefx_ssl_v2_solana_base_trades')
, ref('pumpdotfun_solana_base_trades')
] %}

{% for dex in solana_dexes %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@
AND {{incremental_predicate('tr_1.block_time')}}
{% else %}
AND tr_1.block_time >= TIMESTAMP '{{project_start_date}}'
-- AND tr_1.block_time >= now() - interval '7' day
{% endif %}
INNER JOIN {{ ref('tokens_solana_transfers') }} tr_2
ON tr_2.tx_id = sp.call_tx_id
Expand All @@ -95,14 +94,12 @@
AND {{incremental_predicate('tr_2.block_time')}}
{% else %}
AND tr_2.block_time >= TIMESTAMP '{{project_start_date}}'
-- AND tr_2.block_time >= now() - interval '7' day
{% endif %}
WHERE 1=1
{% if is_incremental() %}
AND {{incremental_predicate('call_block_time')}}
{% else %}
AND call_block_time >= TIMESTAMP '{{project_start_date}}'
-- AND call_block_time >= now() - interval '7' day
{% endif %}
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
AND {{incremental_predicate('trs_1.block_time')}}
{% else %}
AND trs_1.block_time >= TIMESTAMP '{{project_start_date}}'
-- AND trs_1.block_time >= now() - interval '7' day
{% endif %}
INNER JOIN {{ ref('tokens_solana_transfers') }} trs_2
ON trs_2.tx_id = sp.call_tx_id
Expand All @@ -72,7 +71,6 @@
AND {{incremental_predicate('trs_2.block_time')}}
{% else %}
AND trs_2.block_time >= TIMESTAMP '{{project_start_date}}'
-- AND trs_2.block_time >= now() - interval '7' day
{% endif %}
LEFT JOIN {{ ref('solana_utils_token_accounts') }} tk_2 ON tk_2.address = trs_2.from_token_account
AND tk_2.account_type = 'fungible'
Expand All @@ -83,9 +81,7 @@
AND {{incremental_predicate('sp.call_block_time')}}
{% else %}
AND sp.call_block_time >= TIMESTAMP '{{project_start_date}}'
-- AND sp.call_block_time >= now() - interval '7' day --qa
{% endif %}
--force
)

SELECT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
materialized = 'incremental',
file_format = 'delta',
incremental_strategy = 'delete+insert',
unique_key = ['block_date', 'tx_id', 'outer_instruction_index', 'inner_instruction_index', 'block_slot']
unique_key = ['block_date', 'tx_id', 'outer_instruction_index', 'key_inner_instruction_index', 'block_slot']
) }}

{{ solana_sol_transfers_macro(
Expand Down
Loading