Skip to content

[MEX-966] xoxno aggregator integration#1746

Merged
claudiulataretu merged 19 commits intodevelopmentfrom
MEX-966-xoxno-aggregator
Mar 12, 2026
Merged

[MEX-966] xoxno aggregator integration#1746
claudiulataretu merged 19 commits intodevelopmentfrom
MEX-966-xoxno-aggregator

Conversation

@claudiulataretu
Copy link
Copy Markdown
Collaborator

Reasoning

  • The auto-router only evaluated internal xExchange liquidity when computing optimal swap routes, missing potentially better quotes from external aggregators
    • XOXNO aggregator can route through multiple DEXes and liquidity sources, offering better output amounts for certain token pairs
    • Users should always receive the best possible output regardless of which DEX provides the liquidity

Proposed Changes

  • Add XoxnoAggregatorService to fetch quotes and ready-to-sign transactions from the XOXNO API, with error isolation and fallback behavior
  • Extend AutoRouterService to fetch XOXNO and internal quotes in parallel, then select the route with the highest amountOut
  • Add SmartSwapSource enum (INTERNAL | XOXNO) attached to SmartSwapModel so callers know which route was selected
  • Introduce SmartSwapPairModel as a DEX-agnostic replacement for PairModel in SmartSwapRoute.pairs, carrying address, dex, firstToken, and secondToken
  • Store the raw XOXNO amountOut on AutoRouteModel for observability and comparison
  • Add getXoxnoAggregatorEnabled() feature flag in RemoteConfigGetterService for runtime toggling of the integration
  • Re-fetch a fresh XOXNO quote at transaction-build time to ensure the signed transaction is up-to-date; fall back gracefully to internal routing on any error
    • Add unit tests for XoxnoAggregatorService and integration/spec tests for the updated swap-selection logic in AutoRouterService

How to test

  • Enable the XOXNO_AGGREGATOR feature flag in remote config
  • Call the swap GraphQL query for a token pair where XOXNO offers a better rate; verify smartSwap.source returns xoxno
    • Disable the flag or point to an unreachable XOXNO endpoint and confirm the service falls back to internal routing without errors

Signed-off-by: Claudiu Lataretu <claudiu.lataretu@gmail.com>
Signed-off-by: Claudiu Lataretu <claudiu.lataretu@gmail.com>
Signed-off-by: Claudiu Lataretu <claudiu.lataretu@gmail.com>
Signed-off-by: Claudiu Lataretu <claudiu.lataretu@gmail.com>
Signed-off-by: Claudiu Lataretu <claudiu.lataretu@gmail.com>
Signed-off-by: Claudiu Lataretu <claudiu.lataretu@gmail.com>
Signed-off-by: Claudiu Lataretu <claudiu.lataretu@gmail.com>
- convert EGLD into WEGLD if needed to get token metadata
- use raw token inputs for XOXNO aggregator request

Signed-off-by: Claudiu Lataretu <claudiu.lataretu@gmail.com>
Signed-off-by: Claudiu Lataretu <claudiu.lataretu@gmail.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 9, 2026

Codecov Report

❌ Patch coverage is 85.33333% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 53.84%. Comparing base (0433a2b) to head (1335498).
⚠️ Report is 20 commits behind head on development.

Files with missing lines Patch % Lines
...ules/remote-config/remote-config.getter.service.ts 0.00% 8 Missing ⚠️
src/helpers/api.config.service.ts 0.00% 5 Missing ⚠️
...auto-router/mocks/xoxno-aggregator.service.mock.ts 50.00% 4 Missing ⚠️
...odules/auto-router/services/auto-router.service.ts 95.52% 3 Missing ⚠️
...s/auto-router/services/xoxno-aggregator.service.ts 97.61% 1 Missing ⚠️
...uation/services/smart.router.evaluation.service.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@               Coverage Diff               @@
##           development    #1746      +/-   ##
===============================================
+ Coverage        53.51%   53.84%   +0.33%     
===============================================
  Files              298      300       +2     
  Lines            14601    14749     +148     
  Branches          1903     1980      +77     
===============================================
+ Hits              7813     7941     +128     
+ Misses            6782     6485     -297     
- Partials             6      323     +317     
Flag Coverage Δ
unittests 53.84% <85.33%> (+0.33%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

- request xoxno aggregator quote with default sender
- map xoxno aggregator transaction to sender

Signed-off-by: Claudiu Lataretu <claudiu.lataretu@gmail.com>
Signed-off-by: Claudiu Lataretu <claudiu.lataretu@gmail.com>
Signed-off-by: Claudiu Lataretu <claudiu.lataretu@gmail.com>
Signed-off-by: Claudiu Lataretu <claudiu.lataretu@gmail.com>
Signed-off-by: Claudiu Lataretu <claudiu.lataretu@gmail.com>
Signed-off-by: Claudiu Lataretu <claudiu.lataretu@gmail.com>
Signed-off-by: Claudiu Lataretu <claudiu.lataretu@gmail.com>
Signed-off-by: Claudiu Lataretu <claudiu.lataretu@gmail.com>
Signed-off-by: Claudiu Lataretu <claudiu.lataretu@gmail.com>
ioandanpopa
ioandanpopa previously approved these changes Mar 12, 2026
Signed-off-by: Claudiu Lataretu <claudiu.lataretu@gmail.com>
@claudiulataretu claudiulataretu merged commit 4bae5e2 into development Mar 12, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants