-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* reorganize swaps models folder structure * wip jupv6 inner swaps * wip * wip * update logic * refactored * remove comments * docs and tests * cleanup and add metadata cols * pick the larger of the 2 dates so that it gets picked up downstream * fix bad swap index in test seed * initial model and docs * add test cases * adjust input/output swap join logic * remove upper bound * modify incremental logic to work with window function cols * fix seed file * remove no longer valid test cases * put schedule tag last * add relationship test
- Loading branch information
1 parent
c5ca9c0
commit 44416d7
Showing
5 changed files
with
358 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
tx_id,swapper,from_mint,from_amount,to_mint,to_amount,swap_index | ||
33NLhAHDz2dAVRCqfgankDS2CAr78J1Q7LorotWhTaqcT2EDAVzPaWDK2sQsw4zSJM1KVXWzxvx6mDpvzAmNkzN1,CwCjc3BbNEbhqmBV2s1FGJDYxMWeMeJRZEP1zdWQ2dcy,EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v,950.491457,So11111111111111111111111111111111111111112,45.881,0 | ||
3DqnEWswNa8qD7GrqxUi7yyD2fgAk8GYdykHX6aZRQpxbVrdkj3rcFHPF13WuS7oMRs2gqtJGDcjCkDXzD5geprS,AwqwB1CehyuriGiZLXueyo7PmKwHwf23a77SY9GSwpAe,So11111111111111111111111111111111111111112,0.05,EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v,1.01498,0 | ||
5nhXU7f282fFdi3FynukwNLiybV5NYqptUNU6BJH7RpYRPe4mcporxadKmhC9ioxx3vJp9uVmMbXz35QffHTxrFz,UPLyv3ParCUUkYF5y5TW5HTJre7S8VxUChcdU98wBVi,SHDWyBxihqiCj6YekG2GUr7wqKLeLAMK1gHZck9pL6y,20,5qKDWkBejLtRh1UGFV7e58QEkdn2fRyH5ehVXqUYujNW,1977.414794742,0 | ||
5YrfH1RDhZkhh98eikYFcuqRxHY8K87A7hBBFAasaJyCeMW1dr1nG5xNDps3e3GaHnt2cp1tssZJQS2eFaUwcPz9,S5ARSDD3ddZqqqqqb2EUE2h2F1XQHBk7bErRW1WPGe4,So11111111111111111111111111111111111111112,0.00097,EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v,0.018899,0 | ||
GD7mFaoiFFxRKEi4EfYbRHmCRN1Q7hCwrQaZbiRq998vXU7bwY22ET1SwXcgDYKSbVLVTmkbM7HgE7G1HSJDT4T,8wHvL3R61pqVxi3TLmsB9pXYGnJB1saR9rFyfpbk18sN,iotEVVZLEywoTn1QdwNPddxPWszn3zFhEot3MfL9fns,4908.088807,So11111111111111111111111111111111111111112,0.115696271,0 | ||
JLHisghyiom2v1fY4z2tntjQYz7Fupe679pTJSuWaPvymEwEau9WvFbxGEyvvM1SPZqZPHKroLWqZkrrXtH9WkP,AHH4fRDrZv49kWmBqLonvVJbcDNs3J4faXCEWRH584v8,So11111111111111111111111111111111111111112,0.197252365,7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs,0.00247394,0 | ||
LVwfUycnkCw93ywALBfm1zvBcx7sDT9HdTo8wYQooan9CsKTU7BmZLhwQ3mpRSMFCRhDm5Q5GFASAGUmjQTQrJj,6Yfb8TxztNEJxj6pMtF24gPYAaFF9wioZxVRdzvbbJcE,iotEVVZLEywoTn1QdwNPddxPWszn3zFhEot3MfL9fns,144923.75,hntyVP6YFm1Hg25TN9WGLqM12b8TQmcknKrdu1oxWux,35.42,0 | ||
2HDxbrNSMrbGGu1xKKGNm3EbNmqaYxq2Dqpwe6tpKeLXevV2zCdA1feq61kfEVmDvu7mn9cwV9AbQWRE4VQbLkTY,43qeP7zawwuzqDD18erxtAK4C2siTnvuumEGmaD65t1h,2BKiPi4sxd5bq7FZ93Y8hh7pndpU1d7tF49P3vvQg7qu,417575.29457,So11111111111111111111111111111111111111112,0.97847569,0 | ||
sbMujMpco3YpH1DSpBnU2gXU2xEbCkWcsg95HCHBXe3SsiEsEKYv4TAZjaSEGYKSCmp1hRBdoWxXWvDZbWPXoXD,momXXbanL1qHS4q1RPSSv8jam59j1MM2vx1TfQf3e49,So11111111111111111111111111111111111111112,1.1,So11111111111111111111111111111111111111112,1.1008,0 | ||
51zH6E9Q3KknnUwPpJeV9Au6zSzxT6ZmGbEW3v8Lk3GLjcUBosChbyWBWf7NTZEpBiqameEwRPCqio1XdsXPnC4k,GPmE7JCdW1WB9P1ZbAwHrPfHFr5D2nio4hsjCkwoxoKk,27G8MtK7VtTcCHkpASjSDdkWWYfoqT6ggEuKidVJidD4,226.84,EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v,397.690319,0 | ||
5vdYEWuHxJAwENhZdUAqsAaV7mxRVcxPQkS5V4m5yCroSpox1LG1LNLmQnpyfEBbQkikLhxWVYbBkTc9f3BGi5ZU,6vGhnoZZXwjsAv1jRw3UDECzGAqHnFZVMLcsinurAjbR,jucy5XJ76pHVvtPZb5TKRcGQExkwit2P5s4vY8UzmpC,61.72,bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1,55.669332093,0 | ||
3ysjbsjuwREA7QNvm8SmFv5fjkTzZysPn3D5SZWibKoiXPRgniqmV9e5tqz1BZBqmHkbdUQb6tQpoCk9yJcayQDk,3rUVCyDNs5G4zF4PNrXHGvRx6TURTm36YAiAcD53NmrU,LSTxxxnJzKDFSLr4dUkPcmCf5VyryEqzPLz5j4bpxFp,23.368842039,So11111111111111111111111111111111111111112,30.016173133,0 | ||
2G8raofwNadUPTAUWuuFbYtw18DGpqshRMkoVFU1LbyccfDKX1vFgv8QiPFmTq36UAjKaA12crGP3tcpMP94YAnD,BRentiWgeVVNtzMxgJwR9GhMkozjuYiFCCDuMaSS9o2,So11111111111111111111111111111111111111112,0.4,So11111111111111111111111111111111111111112,0.400044593,0 | ||
3B6UatG5gvCrGY5bMQUJaHUpbNXzn8iR92Ze7rsB1pmAmzdUtY1GZd7QSc2C1KgsR5g61skB5LqrM5j6QJoHXY35,CDNWUknR7i1PAhJkap2cxRASp4ttfPFai9B3SE1iFcvK,So11111111111111111111111111111111111111112,0.028321818,pathdXw4He1Xk3eX84pDdDZnGKEme3GivBamGCVPZ5a,0.028323236,0 | ||
5UMtTnzJRZDnKYjM1nnVzU46gnys98EZySiUUkWEaWj2G82D7EhzxQHdPJ6nYDDd5T9dB7KanGQHKwWdXN5KXjGh,DpbCAnke1ubJrvT6meuqijD7FbhBVpYzqMatAAEBrTRy,So11111111111111111111111111111111111111112,9.780663556,EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v,1628.350049,0 | ||
3ho3m3EYmWy5T3GPvL83HQw2ntezXYXYiwqhJyV6izFGPUEkRMgtzT9Hp67ftvaXxCpbZH2W4LWTDR55G7DMEAcF,BeePr3RWQL188BfCtzrqngPzYHrJQjNsN4fb2cDP2ivy,So11111111111111111111111111111111111111112,1.0,EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm,49.119676,0 | ||
3ho3m3EYmWy5T3GPvL83HQw2ntezXYXYiwqhJyV6izFGPUEkRMgtzT9Hp67ftvaXxCpbZH2W4LWTDR55G7DMEAcF,BeePr3RWQL188BfCtzrqngPzYHrJQjNsN4fb2cDP2ivy,EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm,49.119676,So11111111111111111111111111111111111111112,1.000153095,1 | ||
3BBroFipCBy5oh8tktjJrJnDaAsfXVhKixhSTbBNyfKAt5Pa6Httav2dJjgqeU62k82cHoEEKf2wZoahz9bA7mRg,BLBYiq48WcLQ5SxiftyKmPtmsZPUBEnDEjqEnKGAR4zx,EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v,0.057316,So11111111111111111111111111111111111111112,0.000375686,0 | ||
3BBroFipCBy5oh8tktjJrJnDaAsfXVhKixhSTbBNyfKAt5Pa6Httav2dJjgqeU62k82cHoEEKf2wZoahz9bA7mRg,BLBYiq48WcLQ5SxiftyKmPtmsZPUBEnDEjqEnKGAR4zx,So11111111111111111111111111111111111111112,0.000375686,WENWENvqqNya429ubCdR81ZmD69brwQaaBYY6p3LCpk,351.69432,1 | ||
P7hjHyhT9RJwJ2n8jd3srwKVyb9TR6UZwExT3T2VyGdYbQ5HLTb6iN4nR3NZdx39vKz1mZ7PkM5rxTScdZ79D1s,CfK44N3txKiPQBcJkHumt2hxZwhZoJYHgjZUqqdugeof,7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj,0.371991591,bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1,0.38763273,0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
203 changes: 203 additions & 0 deletions
203
models/silver/swaps/jupiter/v6/silver__swaps_intermediate_jupiterv6_2.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,203 @@ | ||
-- depends_on: {{ ref('silver__decoded_instructions_combined') }} | ||
|
||
{{ config( | ||
materialized = 'incremental', | ||
unique_key = "swaps_intermediate_jupiterv6_id", | ||
incremental_predicates = ["dynamic_range_predicate", "block_timestamp::date"], | ||
merge_exclude_columns = ["inserted_timestamp"], | ||
cluster_by = ['block_timestamp::DATE','_inserted_timestamp::DATE'], | ||
post_hook = enable_search_optimization( | ||
'{{this.schema}}', | ||
'{{this.identifier}}', | ||
'ON EQUALITY(tx_id, swapper, from_mint, to_mint)' | ||
), | ||
tags = ['scheduled_non_core'], | ||
) }} | ||
|
||
{% if execute %} | ||
{% set base_query %} | ||
CREATE OR REPLACE TEMPORARY TABLE silver.swaps_intermediate_jupiterv6__intermediate_tmp AS | ||
WITH distinct_entities AS ( | ||
SELECT DISTINCT | ||
tx_id | ||
FROM | ||
{{ ref('silver__decoded_instructions_combined') }} d | ||
WHERE | ||
program_id = 'JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4' | ||
AND event_type IN ('exactOutRoute','sharedAccountsExactOutRoute','sharedAccountsRoute','routeWithTokenLedger','route','sharedAccountsRouteWithTokenLedger') | ||
AND succeeded | ||
{% if is_incremental() %} | ||
AND _inserted_timestamp >= ( | ||
SELECT | ||
MAX(_inserted_timestamp) - INTERVAL '1 hour' | ||
FROM | ||
{{ this }} | ||
) | ||
{% endif %} | ||
) | ||
/* need to re-select all decoded instructions from all tx_ids in incremental subset | ||
in order for the window function to output accurate values */ | ||
SELECT | ||
d.block_timestamp, | ||
d.block_id, | ||
d.tx_id, | ||
d.index, | ||
d.inner_index, | ||
d.succeeded, | ||
d.program_id, | ||
p.key::int AS swap_index, | ||
d.event_type, | ||
lead(d.inner_index) OVER (PARTITION BY d.tx_id, d.index ORDER BY d.inner_index) AS next_summary_swap_index_tmp, | ||
iff(next_summary_swap_index_tmp = d.inner_index, NULL, next_summary_swap_index_tmp) AS next_summary_swap_index, | ||
max(p.key) OVER (PARTITION BY d.tx_id, d.index, d.inner_index) AS last_swap_index, | ||
p.value:inputIndex::int AS route_input_index, | ||
p.value:outputIndex::int AS route_output_index, | ||
_inserted_timestamp | ||
FROM | ||
{{ ref('silver__decoded_instructions_combined') }} d | ||
JOIN | ||
distinct_entities | ||
USING(tx_id) | ||
JOIN | ||
table(flatten(decoded_instruction:args:routePlan)) p | ||
WHERE | ||
program_id = 'JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4' | ||
AND event_type IN ('exactOutRoute','sharedAccountsExactOutRoute','sharedAccountsRoute','routeWithTokenLedger','route','sharedAccountsRouteWithTokenLedger') | ||
AND succeeded | ||
{% endset %} | ||
{% do run_query(base_query) %} | ||
{% set between_stmts = fsc_utils.dynamic_range_predicate("silver.swaps_intermediate_jupiterv6__intermediate_tmp","block_timestamp::date") %} | ||
{% endif %} | ||
|
||
WITH all_routes AS ( | ||
SELECT | ||
* | ||
FROM | ||
silver.swaps_intermediate_jupiterv6__intermediate_tmp | ||
), | ||
summary_base AS ( | ||
SELECT | ||
r.block_timestamp, | ||
r.block_id, | ||
r.tx_id, | ||
r.index, | ||
r.inner_index, | ||
r.succeeded, | ||
r.program_id, | ||
0 AS input_index, | ||
route_output_index AS output_index, | ||
r._inserted_timestamp | ||
FROM | ||
all_routes r | ||
WHERE | ||
swap_index = last_swap_index | ||
), | ||
summary_input_or_ouput_routes AS ( | ||
SELECT | ||
r.*, | ||
iff(route_input_index=0,TRUE,FALSE) AS is_input_swap, | ||
iff(route_output_index=output_index,TRUE,FALSE) AS is_output_swap -- handle situations where there is only 1 swap route (ie. it is both input and output swap) | ||
FROM | ||
all_routes r | ||
JOIN | ||
summary_base b | ||
ON r.tx_id = b.tx_id | ||
AND r.index = b.index | ||
AND coalesce(r.inner_index,-1) = coalesce(b.inner_index,-1) | ||
WHERE | ||
route_input_index = input_index | ||
OR route_output_index = output_index | ||
), | ||
inner_swaps AS ( | ||
SELECT | ||
block_timestamp, | ||
tx_id, | ||
index, | ||
inner_index, | ||
swap_index, | ||
swapper, | ||
from_mint, | ||
from_amount, | ||
to_mint, | ||
to_amount | ||
FROM | ||
{{ ref('silver__swaps_inner_intermediate_jupiterv6') }} | ||
WHERE | ||
{{ between_stmts }} | ||
), | ||
input_swaps AS ( | ||
SELECT | ||
s.tx_id, | ||
s.index, | ||
s.inner_index, | ||
swapper, | ||
from_mint AS mint, | ||
sum(from_amount) AS amount | ||
FROM | ||
summary_input_or_ouput_routes s | ||
LEFT JOIN | ||
inner_swaps i | ||
ON i.block_timestamp::date = s.block_timestamp::date | ||
AND i.tx_id = s.tx_id | ||
AND i.index = s.index | ||
AND i.swap_index = s.swap_index | ||
AND i.inner_index > coalesce(s.inner_index,-1) | ||
AND (i.inner_index < s.next_summary_swap_index | ||
OR s.next_summary_swap_index IS NULL) | ||
WHERE | ||
s.is_input_swap | ||
GROUP BY 1,2,3,4,5 | ||
), | ||
output_swaps AS ( | ||
SELECT | ||
s.tx_id, | ||
s.index, | ||
s.inner_index, | ||
to_mint AS mint, | ||
sum(to_amount) AS amount | ||
FROM | ||
summary_input_or_ouput_routes s | ||
LEFT JOIN | ||
inner_swaps i | ||
ON i.block_timestamp::date = s.block_timestamp::date | ||
AND i.tx_id = s.tx_id | ||
AND i.index = s.index | ||
AND i.swap_index = s.swap_index | ||
AND i.inner_index > coalesce(s.inner_index,-1) | ||
AND (i.inner_index < s.next_summary_swap_index | ||
OR s.next_summary_swap_index IS NULL) | ||
WHERE | ||
s.is_output_swap | ||
GROUP BY 1,2,3,4 | ||
) | ||
SELECT | ||
b.block_timestamp, | ||
b.block_id, | ||
b.tx_id, | ||
b.index, | ||
b.inner_index, | ||
row_number() OVER (PARTITION BY b.tx_id ORDER BY b.index, b.inner_index)-1 AS swap_index, | ||
b.succeeded, | ||
b.program_id, | ||
i.swapper, | ||
i.mint AS from_mint, | ||
i.amount AS from_amount, | ||
o.mint AS to_mint, | ||
o.amount AS to_amount, | ||
b._inserted_timestamp, | ||
{{ dbt_utils.generate_surrogate_key(['b.tx_id','b.index','b.inner_index']) }} AS swaps_intermediate_jupiterv6_id, | ||
sysdate() AS inserted_timestamp, | ||
sysdate() AS modified_timestamp, | ||
'{{ invocation_id }}' AS _invocation_id | ||
FROM | ||
summary_base b | ||
LEFT JOIN | ||
input_swaps i | ||
ON b.tx_id = i.tx_id | ||
AND b.index = i.index | ||
AND coalesce(b.inner_index,-1) = coalesce(i.inner_index,-1) | ||
LEFT JOIN | ||
output_swaps o | ||
ON b.tx_id = o.tx_id | ||
AND b.index = o.index | ||
AND coalesce(b.inner_index,-1) = coalesce(o.inner_index,-1) |
123 changes: 123 additions & 0 deletions
123
models/silver/swaps/jupiter/v6/silver__swaps_intermediate_jupiterv6_2.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
version: 2 | ||
models: | ||
- name: silver__swaps_intermediate_jupiterv6_2 | ||
tests: | ||
- dbt_utils.unique_combination_of_columns: | ||
combination_of_columns: | ||
- TX_ID | ||
- INDEX | ||
- INNER_INDEX | ||
- SWAP_INDEX | ||
where: block_timestamp::date > current_date - 30 | ||
- compare_model_subset: | ||
name: silver__swaps_intermediate_jupiterv6_2_business_logic_test | ||
compare_model: ref('testing__swaps_intermediate_jupiterv6_2') | ||
compare_columns: | ||
- tx_id | ||
- swapper | ||
- from_mint | ||
- round(from_amount,2) | ||
- to_mint | ||
- round(to_amount,2) | ||
- swap_index | ||
model_condition: "where tx_id in ('33NLhAHDz2dAVRCqfgankDS2CAr78J1Q7LorotWhTaqcT2EDAVzPaWDK2sQsw4zSJM1KVXWzxvx6mDpvzAmNkzN1', | ||
'3DqnEWswNa8qD7GrqxUi7yyD2fgAk8GYdykHX6aZRQpxbVrdkj3rcFHPF13WuS7oMRs2gqtJGDcjCkDXzD5geprS', | ||
'5nhXU7f282fFdi3FynukwNLiybV5NYqptUNU6BJH7RpYRPe4mcporxadKmhC9ioxx3vJp9uVmMbXz35QffHTxrFz', | ||
'5YrfH1RDhZkhh98eikYFcuqRxHY8K87A7hBBFAasaJyCeMW1dr1nG5xNDps3e3GaHnt2cp1tssZJQS2eFaUwcPz9', | ||
'GD7mFaoiFFxRKEi4EfYbRHmCRN1Q7hCwrQaZbiRq998vXU7bwY22ET1SwXcgDYKSbVLVTmkbM7HgE7G1HSJDT4T', | ||
'JLHisghyiom2v1fY4z2tntjQYz7Fupe679pTJSuWaPvymEwEau9WvFbxGEyvvM1SPZqZPHKroLWqZkrrXtH9WkP', | ||
'LVwfUycnkCw93ywALBfm1zvBcx7sDT9HdTo8wYQooan9CsKTU7BmZLhwQ3mpRSMFCRhDm5Q5GFASAGUmjQTQrJj', | ||
'2HDxbrNSMrbGGu1xKKGNm3EbNmqaYxq2Dqpwe6tpKeLXevV2zCdA1feq61kfEVmDvu7mn9cwV9AbQWRE4VQbLkTY', | ||
'sbMujMpco3YpH1DSpBnU2gXU2xEbCkWcsg95HCHBXe3SsiEsEKYv4TAZjaSEGYKSCmp1hRBdoWxXWvDZbWPXoXD', | ||
'51zH6E9Q3KknnUwPpJeV9Au6zSzxT6ZmGbEW3v8Lk3GLjcUBosChbyWBWf7NTZEpBiqameEwRPCqio1XdsXPnC4k', | ||
'5vdYEWuHxJAwENhZdUAqsAaV7mxRVcxPQkS5V4m5yCroSpox1LG1LNLmQnpyfEBbQkikLhxWVYbBkTc9f3BGi5ZU', | ||
'3ysjbsjuwREA7QNvm8SmFv5fjkTzZysPn3D5SZWibKoiXPRgniqmV9e5tqz1BZBqmHkbdUQb6tQpoCk9yJcayQDk', | ||
'2G8raofwNadUPTAUWuuFbYtw18DGpqshRMkoVFU1LbyccfDKX1vFgv8QiPFmTq36UAjKaA12crGP3tcpMP94YAnD', | ||
'3B6UatG5gvCrGY5bMQUJaHUpbNXzn8iR92Ze7rsB1pmAmzdUtY1GZd7QSc2C1KgsR5g61skB5LqrM5j6QJoHXY35', | ||
'5UMtTnzJRZDnKYjM1nnVzU46gnys98EZySiUUkWEaWj2G82D7EhzxQHdPJ6nYDDd5T9dB7KanGQHKwWdXN5KXjGh', | ||
'3ho3m3EYmWy5T3GPvL83HQw2ntezXYXYiwqhJyV6izFGPUEkRMgtzT9Hp67ftvaXxCpbZH2W4LWTDR55G7DMEAcF', | ||
'3BBroFipCBy5oh8tktjJrJnDaAsfXVhKixhSTbBNyfKAt5Pa6Httav2dJjgqeU62k82cHoEEKf2wZoahz9bA7mRg', | ||
'P7hjHyhT9RJwJ2n8jd3srwKVyb9TR6UZwExT3T2VyGdYbQ5HLTb6iN4nR3NZdx39vKz1mZ7PkM5rxTScdZ79D1s')" | ||
recent_date_filter: &recent_date_filter | ||
config: | ||
where: > | ||
/* this model does not work before this date as inner_swaps encoded data was not working. Use v1 model instead */ | ||
block_timestamp::date >= '2023-08-03' | ||
AND _inserted_timestamp >= current_date - 7 | ||
columns: | ||
- name: BLOCK_TIMESTAMP | ||
description: "{{ doc('block_timestamp') }}" | ||
tests: | ||
- not_null: *recent_date_filter | ||
- dbt_expectations.expect_row_values_to_have_recent_data: | ||
datepart: day | ||
interval: 2 | ||
- name: BLOCK_ID | ||
description: "{{ doc('block_id') }}" | ||
tests: | ||
- not_null: *recent_date_filter | ||
- name: TX_ID | ||
description: "{{ doc('tx_id') }}" | ||
tests: | ||
- not_null: *recent_date_filter | ||
- name: INDEX | ||
description: "{{ doc('event_index') }}" | ||
tests: | ||
- not_null: *recent_date_filter | ||
- name: INNER_INDEX | ||
description: "{{ doc('inner_index') }}" | ||
- name: SWAP_INDEX | ||
description: "{{ doc('swaps_swap_index') }}" | ||
tests: | ||
- not_null: *recent_date_filter | ||
- name: SUCCEEDED | ||
description: "{{ doc('tx_succeeded') }}" | ||
tests: | ||
- not_null: *recent_date_filter | ||
- name: PROGRAM_ID | ||
description: "{{ doc('program_id') }}" | ||
tests: | ||
- not_null: *recent_date_filter | ||
- name: SWAPPER | ||
description: "{{ doc('swaps_swapper') }}" | ||
tests: | ||
- not_null: | ||
where: succeeded = TRUE AND _inserted_timestamp >= current_date - 7 | ||
- name: FROM_MINT | ||
description: "{{ doc('swaps_from_mint') }}" | ||
tests: | ||
- not_null: *recent_date_filter | ||
- name: FROM_AMOUNT | ||
description: "{{ doc('swaps_from_amt') }}" | ||
tests: | ||
- not_null: *recent_date_filter | ||
- name: TO_MINT | ||
description: "{{ doc('swaps_to_mint') }}" | ||
tests: | ||
- not_null: *recent_date_filter | ||
- name: TO_AMOUNT | ||
description: "{{ doc('swaps_to_amt') }}" | ||
tests: | ||
- not_null: *recent_date_filter | ||
- name: _INSERTED_TIMESTAMP | ||
description: "{{ doc('_inserted_timestamp') }}" | ||
tests: | ||
- not_null | ||
- name: SWAPS_INTERMEDIATE_JUPITERV6_ID | ||
description: '{{ doc("pk") }}' | ||
tests: | ||
- unique: *recent_date_filter | ||
- name: INSERTED_TIMESTAMP | ||
description: '{{ doc("inserted_timestamp") }}' | ||
tests: | ||
- not_null: *recent_date_filter | ||
- name: MODIFIED_TIMESTAMP | ||
description: '{{ doc("modified_timestamp") }}' | ||
tests: | ||
- not_null: *recent_date_filter | ||
- name: _INVOCATION_ID | ||
description: '{{ doc("_invocation_id") }}' | ||
tests: | ||
- not_null: | ||
name: test_silver__not_null_swaps_intermediate_jupiterv6_2__invocation_id | ||
<<: *recent_date_filter |