Skip to content

feat: add translation blueprints for Soroswap Router and Blend Pool - #385

Merged
Osuochasam merged 1 commit into
Open-audit-foundation:mainfrom
godamongstmen897:feat/soroswap-blend-blueprints
Jul 26, 2026
Merged

feat: add translation blueprints for Soroswap Router and Blend Pool#385
Osuochasam merged 1 commit into
Open-audit-foundation:mainfrom
godamongstmen897:feat/soroswap-blend-blueprints

Conversation

@godamongstmen897

Copy link
Copy Markdown
Contributor

Closes #378

Summary

Implements translation blueprints for the Soroswap Router and Blend Protocol pools—the two primary DeFi event sources on Stellar/Soroban—to translate raw event logs into human-readable descriptions across all four supported languages (en, es, fr, zh).


Key Changes

1. Soroswap Router Blueprint (lib/translator/blueprints/soroswap-router.ts)

  • Implemented factory function decoding swap, add_liquidity, and remove_liquidity event payloads.
  • Decodes real struct-typed (XDR Map) data payloads matching Soroswap's event.rs schema.
  • Returns null for unrecognized event topics.

2. Blend Pool Blueprint (lib/translator/blueprints/blend-pool.ts)

  • Implemented factory function decoding supply, withdraw, borrow, repay (tuple/Vec-encoded payloads), and liquidate (fill_auction auction_type=0) events.
  • Decodes reserve assets, user addresses, and token amounts cleanly.

3. Localization & Type Schema (lib/translator/types.ts & lib/translator/locales/*)

  • Added soroswap and blend namespaces to TranslationMap.
  • Populated localized templates across all four locale files (en.ts, es.ts, fr.ts, zh.ts).

4. Registry Integration (lib/translator/registry.ts)

  • Registered both blueprints in buildRegistry() with official Mainnet and Testnet contract IDs sourced from Soroswap Core and Blend Capital deployment manifests.

Verification

  • Registry Linting: npm run lint:registry passed cleanly.
  • Unit Tests: Added 48 tests across 2 new test files using real @stellar/stellar-sdk XDR encoders.
    • Verified matches() filtering for contract IDs.
    • Verified graceful null returns for unknown event topics.
    • Verified non-empty, distinct output across all four locales (en, es, fr, zh).

Soroswap (primary DEX) and Blend (primary lending protocol) generate the
majority of DeFi event traffic on Stellar/Soroban but currently render as
Cryptic in the feed. Adds two new blueprints following the established
pattern (see SDEX/SAC), registered in buildRegistry() with documented
mainnet/testnet contract IDs sourced from the soroswap/core and
blend-capital/blend-utils deployment manifests.

- soroswap-router.ts: handles add/remove liquidity and swap events, whose
  data payload is a struct (XDR Map) per the real event.rs schema.
- blend-pool.ts: handles supply/withdraw/borrow/repay (tuple/Vec-encoded
  data) plus liquidate, mapped from the real fill_auction(auction_type=0)
  event emitted for user liquidations.
- Adds soroswap/blend namespaces to TranslationMap and all four locales
  (en/es/fr/zh).
- Test fixtures use real stellar-sdk XDR encoders (matching the pattern in
  decode-map-vec.test.ts) rather than hand-typed hex, since both schemas
  carry composite (Map/Vec) data payloads.

Closes Open-audit-foundation#378

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 25, 2026 11:39

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Osuochasam
Osuochasam merged commit 6a4f0e7 into Open-audit-foundation:main Jul 26, 2026
2 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.

Implement translation blueprints for Soroswap Router and Blend Protocol — the two largest unregistered protocol event sources

3 participants