Skip to content

Conversation

@discochuck
Copy link
Contributor

Thank you for contributing to Spellbook 🪄

Please open the PR in draft and mark as ready when you want to request a review.

Description:

Attempting to add Odos v2 to dex_aggregator for Avalanche blockchain.


quick links for more information:

@cursor
Copy link

cursor bot commented Dec 15, 2025

PR Summary

Adds Odos v2 Avalanche C-Chain trades model and source, integrates it into odos_trades, and updates tests, metadata, and seed data.

  • Odos Avalanche C integration:
    • Add odos_avalanche_c_trades model (v2) with incremental config, block_month/block_number, and normalized native token handling.
    • New source odos_v2_avalanche_c.OdosRouterV2_evt_Swap.
    • Update data tests to version 2 and enforce unique key.
  • Aggregation:
    • Include ref('odos_avalanche_c_trades') in odos_trades union and add contributor couchdicks.
  • Metadata:
    • Extend odos_trades schema meta.blockchain to include avalanche_c.
    • Adjust Avalanche C schema: tags, sector to dex_aggregator, descriptions, and column set (adds block_month, block_number).
  • Seeds:
    • Append Avalanche C Odos v2 validation row in dex_aggregator_seed.csv.

Written by Cursor Bugbot for commit 134fa21. Configure here.

@github-actions github-actions bot marked this pull request as draft December 15, 2025 13:28
@github-actions github-actions bot added WIP work in progress dbt: dex covers the DEX dbt subproject labels Dec 15, 2025
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment @cursor review or bugbot run to trigger another review on this PR

CAST(ARRAY[-1] AS ARRAY<bigint>) AS trace_address
FROM
dexs
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Missing required columns in avalanche trades model

The odos_avalanche_c_trades model is missing 8 columns that odos_trades.sql expects to select via UNION ALL: token_bought_symbol, token_sold_symbol, token_pair, token_bought_amount, token_sold_amount, amount_usd, tx_from, and tx_to. Other chains (ethereum, base, arbitrum) have an odos_v2_*_trades intermediate model that joins with token metadata, prices, and transactions tables to compute these columns. The avalanche model directly queries raw event data without these joins, causing a schema mismatch that will fail the UNION operation.

Additional Locations (1)

Fix in Cursor Fix in Web

Copy link
Contributor Author

@discochuck discochuck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed [odos_avalanche_c_trades.sql] to [odos_v2_avalanche_c_trades.sql]

will need to add a [odos_avalanche_c_trades.sql] separately per cursor autobot:
--snip
Bug: Missing required columns in avalanche trades model
The odos_avalanche_c_trades model is missing 8 columns that odos_trades.sql expects to select via UNION ALL: token_bought_symbol, token_sold_symbol, token_pair, token_bought_amount, token_sold_amount, amount_usd, tx_from, and tx_to. Other chains (ethereum, base, arbitrum) have an odos_v2_*_trades intermediate model that joins with token metadata, prices, and transactions tables to compute these columns. The avalanche model directly queries raw event data without these joins, causing a schema mismatch that will fail the UNION operation.
--snip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dbt: dex covers the DEX dbt subproject WIP work in progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant