Skip to content

Add Odos Avalanche aggregator trades#9775

Open
nyx-discochuck wants to merge 5 commits into
duneanalytics:mainfrom
nyx-discochuck:add-odos-avalanche-dex-aggregator
Open

Add Odos Avalanche aggregator trades#9775
nyx-discochuck wants to merge 5 commits into
duneanalytics:mainfrom
nyx-discochuck:add-odos-avalanche-dex-aggregator

Conversation

@nyx-discochuck

@nyx-discochuck nyx-discochuck commented Jun 13, 2026

Copy link
Copy Markdown

Summary

Adds Odos coverage for Avalanche C-Chain in dex_aggregator.trades.

This PR adds separate Avalanche Odos v1 and v2 trade models, wraps them in the chain-level odos_avalanche_c_trades union, and includes Avalanche in the cross-chain odos_trades model. It also adds seed coverage from live Dune samples so the aggregator trade output can be checked against known transactions.

What changed

  • Added odos_v1_avalanche_c_trades to preserve historical Odos v1 routed swaps.
  • Added odos_v2_avalanche_c_trades for current Odos v2 routed swaps.
  • Reworked odos_avalanche_c_trades into the Avalanche chain-level union over v1 and v2.
  • Added Avalanche to the cross-chain odos_trades union.
  • Added two dex_aggregator_seed rows for Avalanche Odos sample trades.
  • Added/updated schema metadata and tests for the new Avalanche models.

Why this helps

Odos is a meaningful Avalanche DEX aggregator, but its Avalanche activity was not exposed through Spellbook's standardized dex_aggregator.trades abstraction. This makes Odos Avalanche routes queryable through the same cross-chain aggregator interface used by analysts and dashboards.

Validation

  • dbt parse
  • Targeted dbt compile for the new Odos Avalanche models and affected unions
  • git diff --check
  • Live DuneSQL validation query 01KTZ616PQRJ17CK7NZ3GADMB1 matched both added seed rows
  • Live DuneSQL v1 smoke query confirmed varbinary address rendering
  • Source-key duplicate check found 86,694 v1 rows with 0 duplicate (tx_hash, evt_index, output_index) keys
  • Confirmed the v1, v2, wrapper, and root models are included when CI excludes tag:prod_exclude

Notes for reviewers

The v1 model is intentionally included alongside v2 so the Avalanche chain-level Odos model does not drop historical v1 trade coverage.

@cursor

cursor Bot commented Jun 13, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Replacing the inline v1 Avalanche spell with v2-only union changes published trade history and volume for that chain; downstream DEX metrics may shift until v1 is reintroduced if still needed.

Overview
Adds Odos Router v2 trade ingestion on Avalanche via OdosRouterV2_evt_Swap, following the same incremental merge pattern as other chains’ odos_v2_* models (start date 2023-07-13, WAVAX native-token mapping, USD via price joins).

odos_avalanche_c_trades no longer embeds the legacy v1 OdosRouter_evt_Swapped spell (and drops incremental/materialization config there); it now unions version-specific models and currently only references odos_v2_avalanche_c_trades, so v1 Avalanche history from the old inline model is not carried forward unless a separate v1 model is added later.

Wires odos_avalanche_c_trades into the cross-chain odos_trades union, documents odos_v2_avalanche_c_trades in _schema.yml (unique-key + check_dex_aggregator_seed for version 2), fixes tags from dfx to odos, and adds two seed rows for aggregator validation.

Reviewed by Cursor Bugbot for commit 686b99a. Configure here.

@github-actions github-actions Bot marked this pull request as draft June 13, 2026 00:36
@github-actions github-actions Bot added WIP work in progress dbt: dex covers the DEX dbt subproject labels Jun 13, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start.

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

Reviewed by Cursor Bugbot for commit 686b99a. Configure here.

@nyx-discochuck nyx-discochuck force-pushed the add-odos-avalanche-dex-aggregator branch from 686b99a to 8cc4044 Compare June 13, 2026 00:56
@nyx-discochuck nyx-discochuck marked this pull request as ready for review June 13, 2026 01:29
@github-actions github-actions Bot added ready-for-review this PR development is complete, please review and removed WIP work in progress labels Jun 13, 2026

@nyx-discochuck nyx-discochuck left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

looks good

@nyx-discochuck

Copy link
Copy Markdown
Author

recheck

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 ready-for-review this PR development is complete, please review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant