feat(dex): add Agra DEX (ethereum, hyperevm)#9881
Open
cxheng315 wants to merge 9 commits into
Open
Conversation
cxheng315
marked this pull request as ready for review
July 9, 2026 03:53
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8078ec198f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Drop the duplicated taker aggregate leg of Seaport matchOrders settlements using settlement_evt_ordersmatched; set agra_start_date to 2026-03-01. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Collapse the near-identical agra_ethereum/agra_hyperevm base_trades models (105 lines each, differing only by chain) into a parameterized agra_base_trades(blockchain, start_date) macro. Each chain model is now config + a one-line macro call. Compiled SQL is unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add a branded agra.trades view via dex_project_trades('agra'), unioning the
enriched dex_<chain>_trades filtered to project = 'agra'. Inherits amount_usd
from the sector enrichment; currently covers ethereum and hyperevm. Register
the view in dex_trades_views_schema.yml.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Collapse offer/consideration to one deterministic row per (tx_hash, evt_index) via row_number, so a malformed multi-token Agra order cannot break the unique key or the incremental merge. Agra is a CLOB (1:1 settlement), so this is a no-op on all real data; verified output is byte-identical to before. Uses a row_number subquery rather than QUALIFY, which DuneSQL/Trino does not support. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
cxheng315
force-pushed
the
agra-into-9833
branch
from
July 12, 2026 06:08
8078ec1 to
ae64a64
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thank you for contributing to Spellbook 🪄
Description
Adds the Agra DEX integration (a Seaport-fork order-settlement / direct DEX) to the DEX
sector for ethereum and hyperevm, stacked on top of the combined Pharaoh / Odos /
Ramses / Nest branch from #9833.
Agra — what's included
agra_multichain(sources/_sector/dex/trades/ethereum/_sources.yml) withsettlement_evt_orderfulfilledandsettlement_evt_ordersmatched— one multichain sourceserves both chains.
agra_base_trades(blockchain, start_date)macro; each chain model is config + a one-line call.dex_ethereum_base_trades/dex_hyperevm_base_tradesand index_info.unique_combination_of_columns,check_dex_base_trades_seed) + per-chain seeds.agra.tradesproject view viadex_project_trades('agra'); inheritsamount_usdfromthe sector enrichment.
Notes
OrderFulfilled(offer → token_bought, consideration → token_sold) and dedupesthe aggregate taker leg of
matchOrderssettlements.volume_usdcomes from the standard sector enrichment index.trades.🤖 Generated with Claude Code