Skip to content

Add World MegaETH entries to dex.trades and perpetual.trades#9508

Open
thecaptncrunch wants to merge 7 commits intomainfrom
cursor/megaeth-orderbook-dex-world-b080
Open

Add World MegaETH entries to dex.trades and perpetual.trades#9508
thecaptncrunch wants to merge 7 commits intomainfrom
cursor/megaeth-orderbook-dex-world-b080

Conversation

@thecaptncrunch
Copy link
Copy Markdown
Collaborator

@thecaptncrunch thecaptncrunch commented Mar 31, 2026

Thank you for contributing to Spellbook 🪄

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

Description:

Re-scoped this PR per request to remove prior dex_aggregator.trades work and instead add World MegaETH entries directly into:

  1. dex.trades via world_megaeth.compositeexchange_evt_orderbookregistered
  2. perpetual.trades via world_megaeth.compositeexchange_evt_perporderbookregistered

Changes made

Removed previous scope

  • Dropped prior world model under dbt_subprojects/dex/models/_projects/world/megaeth/.
  • Reverted all earlier aggregator_trades modifications from this branch so no dex_aggregator.trades changes remain.

Added to dex.trades lineage

  • Added new platform model:
    • dbt_subprojects/dex/models/trades/megaeth/platforms/world_megaeth_base_trades.sql
  • Wired into MegaETH base union:
    • dbt_subprojects/dex/models/trades/megaeth/dex_megaeth_base_trades.sql
  • Added schema entry:
    • dbt_subprojects/dex/models/trades/megaeth/_schema.yml
  • Source now includes required world decoded event table(s):
    • sources/world/megaeth/world_megaeth_sources.yml

Added to perpetual.trades lineage

  • Added project model:
    • dbt_subprojects/hourly_spellbook/models/_sector/perpetual/projects/world/megaeth/world_megaeth_perpetual_trades.sql
  • Added project schema:
    • dbt_subprojects/hourly_spellbook/models/_sector/perpetual/projects/world/megaeth/world_megaeth_schema.yml
  • Wired into cross-project perpetual union:
    • dbt_subprojects/hourly_spellbook/models/_sector/perpetual/perpetual_trades.sql
  • Updated perpetual sector metadata to include MegaETH:
    • dbt_subprojects/hourly_spellbook/models/_sector/perpetual/perpetual_schema.yml

Validation

Compiled successfully (dbt 1.9.1) for impacted models:

  • world_megaeth_base_trades
  • dex_megaeth_base_trades
  • dex_megaeth_trades
  • world_megaeth_perpetual_trades
  • perpetual_trades

(Compilation was run with pipenv run dbt ... in both dex and hourly_spellbook subprojects.)


quick links for more information:

Slack Thread

Open in Web Open in Cursor 

Co-authored-by: thecaptncrunch <thecaptncrunch@users.noreply.github.com>
@github-actions github-actions bot added WIP work in progress dbt: dex covers the DEX dbt subproject labels Mar 31, 2026
cursoragent and others added 3 commits March 31, 2026 16:16
Co-authored-by: thecaptncrunch <thecaptncrunch@users.noreply.github.com>
Co-authored-by: thecaptncrunch <thecaptncrunch@users.noreply.github.com>
…ntries

Co-authored-by: thecaptncrunch <thecaptncrunch@users.noreply.github.com>
@github-actions github-actions bot added the dbt: hourly covers the hourly dbt subproject label Mar 31, 2026
Co-authored-by: thecaptncrunch <thecaptncrunch@users.noreply.github.com>
@cursor cursor bot changed the title Add World Orderbook DEX (MegaETH) to dex_aggregator.trades Add World MegaETH entries to dex.trades and perpetual.trades Mar 31, 2026
@thecaptncrunch thecaptncrunch marked this pull request as ready for review March 31, 2026 17:30
@github-actions github-actions bot added ready-for-review this PR development is complete, please review and removed WIP work in progress labels Mar 31, 2026
@jeff-dude jeff-dude self-assigned this Apr 16, 2026
…joins

Carry evt_block_date/block_number through base_events and transfer_legs,
and use (tx_hash, block_date, block_number) as the join/partition keys
for txs, sold_candidates, bought_candidates, and the final select to
prevent cross-block collisions.

Made-with: Cursor
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 dbt: hourly covers the hourly 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.

3 participants