Conversation
- Add platform model: uniswap_v4_tempo_base_trades.sql - Add chain-level union: dex_tempo_base_trades.sql - Add chain-level enriched trades: dex_tempo_trades.sql - Add token volumes daily: dex_tempo_token_volumes_daily.sql - Add 'tempo' to cross-chain dex_trades.sql, dex_token_volumes_daily.sql, dex_trades_view_test.sql - Add source definitions for uniswap_v4_tempo (PoolManager events + calls) - Add schema, seed CSV, and seed schema entry Co-authored-by: jeff-dude <jeff-dude@users.noreply.github.com>
- Add tempo_exchange_tempo_base_trades.sql platform model using swapExactAmountIn and swapExactAmountOut call tables - Add chain-level models: dex_tempo_base_trades, dex_tempo_trades, dex_tempo_token_volumes_daily - Add sources YAML for tempoexchange_tempo decoded tables - Add schema, seed CSV, and seed schema for tempo_exchange - Wire tempo into dex_trades cross-chain union Co-authored-by: jeff-dude <jeff-dude@users.noreply.github.com>
…ap-v4-7a59' into cursor/CUR2-1693-tempo-exchange-base-trades-bf73 # Conflicts: # dbt_subprojects/dex/models/trades/tempo/_schema.yml # dbt_subprojects/dex/models/trades/tempo/dex_tempo_base_trades.sql # dbt_subprojects/dex/seeds/trades/_schema.yml # sources/_sector/dex/trades/tempo/_sources.yml Co-authored-by: jeff-dude <jeff-dude@users.noreply.github.com>
|
@cursor push a temp commit in |
|
Added a temporary 14-day filter on non-incremental runs in |
…dite CI This is a temporary commit to speed up CI runs. Must be reverted before merge. Co-authored-by: jeff-dude <jeff-dude@users.noreply.github.com>
dbt_subprojects/dex/models/trades/tempo/platforms/tempo_exchange_tempo_base_trades.sql
Outdated
Show resolved
Hide resolved
dbt_subprojects/dex/models/trades/tempo/platforms/tempo_exchange_tempo_base_trades.sql
Outdated
Show resolved
Hide resolved
dbt_subprojects/dex/models/trades/tempo/platforms/tempo_exchange_tempo_base_trades.sql
Outdated
Show resolved
Hide resolved
dbt_subprojects/dex/models/trades/tempo/platforms/tempo_exchange_tempo_base_trades.sql
Outdated
Show resolved
Hide resolved
|
@cursor apply above suggest changes in comment |
|
Applied all four review suggestions from @jeff-dude to
|
- Remove unnecessary CAST on amount columns - Use call_trace_address for ROW_NUMBER ordering - Add call_block_date to CTEs and use directly - Use call_tx_from as taker instead of NULL Co-authored-by: jeff-dude <jeff-dude@users.noreply.github.com>
|
@cursor can you add the uniswap v2 and v3 models for tempo too? similar to v4, there are existing macros we can use. here are tables: |
|
Added Uniswap V2 and V3 models for the Tempo chain:
All models compile successfully. |
- Add uniswap_v2_tempo_base_trades using uniswap_compatible_v2_trades macro - Add uniswap_v3_tempo_base_trades using uniswap_compatible_v3_trades macro - Add V2/V3 source declarations for decoded tables - Add schema entries with seed tests (shared uniswap_tempo seed, filtered by version) - Wire V2/V3 into dex_tempo_base_trades union (now 4 platforms) Co-authored-by: jeff-dude <jeff-dude@users.noreply.github.com>
|
todo:
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
Bugbot Autofix prepared fixes for all 3 issues found in the latest run.
- ✅ Fixed: Temporary CI window limits production history
- Removed the
WHERE block_time >= now() - interval '14' dayfilter from both the chain_trades and as_is_dexs non-incremental paths in dex_trades.sql, restoring full-refresh behavior.
- Removed the
- ✅ Fixed: Event index collisions across swap types
- Moved ROW_NUMBER() computation from individual swap CTEs to after the UNION ALL in the final SELECT, so evt_index is assigned globally per tx_hash across both swap types.
- ✅ Fixed: Synthetic event indexes drop cross-protocol trades
- Added
projectto the dedup partition in dex_tempo_base_trades.sql so that synthetic evt_index values from tempo_exchange cannot collide with real evt_index values from other protocols in the same transaction.
- Added
Or push these changes by commenting:
@cursor push 9a274a5a2a
Preview (9a274a5a2a)
diff --git a/dbt_subprojects/dex/models/trades/dex_trades.sql b/dbt_subprojects/dex/models/trades/dex_trades.sql
--- a/dbt_subprojects/dex/models/trades/dex_trades.sql
+++ b/dbt_subprojects/dex/models/trades/dex_trades.sql
@@ -110,8 +110,6 @@
{%- else -%}
{% if is_incremental() %}
WHERE {{ incremental_predicate('block_time') }}
- {% else %}
- WHERE block_time >= now() - interval '14' day -- temp CI filter, revert before merge
{% endif %}
{%- endif %}
{% if not loop.last %}
@@ -154,8 +152,6 @@
{%- else -%}
{% if is_incremental() %}
WHERE {{ incremental_predicate('block_time') }}
- {% else %}
- WHERE block_time >= now() - interval '14' day -- temp CI filter, revert before merge
{% endif %}
{%- endif %}
{% if not loop.last %}
diff --git a/dbt_subprojects/dex/models/trades/tempo/dex_tempo_base_trades.sql b/dbt_subprojects/dex/models/trades/tempo/dex_tempo_base_trades.sql
--- a/dbt_subprojects/dex/models/trades/tempo/dex_tempo_base_trades.sql
+++ b/dbt_subprojects/dex/models/trades/tempo/dex_tempo_base_trades.sql
@@ -64,7 +64,7 @@
, final as (
select
*
- , row_number() over (partition by tx_hash, evt_index order by tx_hash) as duplicates_rank
+ , row_number() over (partition by tx_hash, evt_index, project order by tx_hash) as duplicates_rank
from
add_tx_columns
)
diff --git a/dbt_subprojects/dex/models/trades/tempo/platforms/tempo_exchange_tempo_base_trades.sql b/dbt_subprojects/dex/models/trades/tempo/platforms/tempo_exchange_tempo_base_trades.sql
--- a/dbt_subprojects/dex/models/trades/tempo/platforms/tempo_exchange_tempo_base_trades.sql
+++ b/dbt_subprojects/dex/models/trades/tempo/platforms/tempo_exchange_tempo_base_trades.sql
@@ -22,7 +22,7 @@
, contract_address AS project_contract_address
, call_tx_hash AS tx_hash
, call_tx_from AS taker
- , ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_trace_address) AS row_num
+ , call_trace_address
FROM {{ source('tempoexchange_tempo', 'stablecoindex_call_swapexactamountin') }}
WHERE call_success = true
{% if is_incremental() -%}
@@ -42,7 +42,7 @@
, contract_address AS project_contract_address
, call_tx_hash AS tx_hash
, call_tx_from AS taker
- , ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_trace_address) AS row_num
+ , call_trace_address
FROM {{ source('tempoexchange_tempo', 'stablecoindex_call_swapexactamountout') }}
WHERE call_success = true
{% if is_incremental() -%}
@@ -72,5 +72,5 @@
, CAST(NULL AS VARBINARY) AS maker
, dexs.project_contract_address
, dexs.tx_hash
- , dexs.row_num AS evt_index
+ , ROW_NUMBER() OVER (PARTITION BY dexs.tx_hash ORDER BY dexs.call_trace_address) AS evt_index
FROM dexsYou can send follow-ups to this agent here.
Comment @cursor review or bugbot run to trigger another review on this PR
dbt_subprojects/dex/models/trades/tempo/platforms/tempo_exchange_tempo_base_trades.sql
Show resolved
Hide resolved
dbt_subprojects/dex/models/trades/tempo/platforms/tempo_exchange_tempo_base_trades.sql
Show resolved
Hide resolved
|
@cursor can you remove the seed files, seed schema additions and seed tests? |
|
Removed all seed-related artifacts for tempo DEXs:
All models still compile cleanly. |
…po DEXs Co-authored-by: jeff-dude <jeff-dude@users.noreply.github.com>
Merge uniswap_v4_tempo evt tables (PoolManager_evt_Swap, PoolManager_evt_Initialize) into sources/_sector/dex/trades/tempo/_sources.yml and delete the separate sources/uniswap/tempo/uniswap_tempo_sources.yml. Co-authored-by: jeff-dude <jeff-dude@users.noreply.github.com>
|
@cursor revert temp commit which hardcoded time filter on dex_trades model |
Co-authored-by: jeff-dude <jeff-dude@users.noreply.github.com>
tomfutago
left a comment
There was a problem hiding this comment.
lgtm, just seeds missing and entry in dex_info (if that's still a thing)
Co-authored-by: jeff-dude <jeff-dude@users.noreply.github.com>




Thank you for contributing to Spellbook 🪄
Description:
Adds DEX trading support for the Tempo blockchain, wiring four protocols into the full
dex.tradeslineage.Tempo Exchange (
tempo_exchange_tempo_base_trades.sql):tempoexchange_tempo.stablecoindex_call_swapexactamountin— exact input swapstempoexchange_tempo.stablecoindex_call_swapexactamountout— exact output swapstokenIn/tokenOutand actual amounts to the standard base trades schemacall_success = true; usesincremental_predicatefor incremental runsUniswap V2 (
uniswap_v2_tempo_base_trades.sql):uniswap_compatible_v2_tradesmacro withpair_evt_swapanduniswapv2factory_evt_paircreatedsourcesUniswap V3 (
uniswap_v3_tempo_base_trades.sql):uniswap_compatible_v3_tradesmacro withuniswapv3pool_evt_swapanduniswapv3factory_evt_poolcreatedsourcesUniswap V4 (
uniswap_v4_tempo_base_trades.sql):uniswap_compatible_v4_tradesmacro withPoolManager_call_SwapsourceChain-level models (new
tempo/directory):dex_tempo_base_trades.sql— unions all four platform base trades withadd_tx_columnsdex_tempo_trades.sql— enriches with token metadata and USD pricing viaenrich_dex_tradesdex_tempo_token_volumes_daily.sql— daily token volume aggregationInfrastructure:
sources/_sector/dex/trades/tempo/_sources.ymldeclaring decoded tables for all protocolssources/uniswap/tempo/uniswap_tempo_sources.ymlseeds/trades/_schema.yml'tempo'added to thechainslist index_trades.sqldex_trades.sqlto expedite CI (to be reverted before merge)All models compile successfully via
dbt compile.quick links for more information:
Linear Issue: CUR2-1693