Skip to content

Slippage-protected swaps, swap test suite, and contract ABI docs - #1344

Merged
martinzhames merged 4 commits into
dupdab:mainfrom
charityagbenu12-cmd:drips/1223-1224-1232
Oct 23, 2026
Merged

martinzhames merged 4 commits into
dupdab:mainfrom
charityagbenu12-cmd:drips/1223-1224-1232

Conversation

@charityagbenu12-cmd

Copy link
Copy Markdown
Contributor

Summary

Slippage-protected swaps, swap test suite, and contract ABI docs

What was solved

#1223 — [P1] slippage_protection: add integration with liquidity_router contract

Wire the standalone slippage_protection contract into liquidity_router so every USDC→fiat swap is gated by a slippage check, add integration tests for breach rejection and in-bounds success, and support per-merchant max slippage sourced from merchant_registry metadata.

Addressed:

  • Changed: dabdub_contracts/contracts/liquidity_router/src/lib.rs, dabdub_contracts/contracts/liquidity_router/src/test.rs, dabdub_contracts/contracts/liquidity_router/Cargo.toml
  • liquidity_router must call slippage_protection.check_slippage() before executing any USDC→fiat swap/conversion
  • Add integration test asserting router swap is rejected when slippage bounds are breached
  • Add integration test asserting router swap succeeds when within bounds

#1224 — [P1] Add Soroban contract ABI documentation (JSON schemas)

Add machine-readable Soroban contract ABI documentation: generate one JSON ABI file per contract under docs/abi/, link them from the README, and add a CI step that regenerates/verifies the ABIs are up to date.

Addressed:

  • Changed: docs/abi/README.md, docs/abi/README.md, README.md, .github/workflows/ci.yml
  • Create docs/abi/ directory containing one JSON ABI file per contract (admin_auth, admin_timelock, batch_payments, fee_calculator, fee_distributor, liquidity_router)
  • ABI JSON should reflect each contract's public call signatures (functions, args, return types) derived from the Rust source / stellar contract inspect output
  • Update README.md to link to the ABI docs directory

#1232 — [P1] liquidity_router: add slippage-protected swap test with real token mocks

Add a slippage-protected swap test suite to the liquidity_router contract using real token mocks (USDC and fiat token), covering successful swaps within tolerance, reverts when price moves beyond tolerance, and fee deduction before swap, plus documentation of the expected liquidity source.

Addressed:

  • Changed: dabdub_contracts/contracts/liquidity_router/src/lib.rs, dabdub_contracts/contracts/liquidity_router/src/test.rs
  • Add mock USDC and fiat token contracts (Soroban token mocks) usable by the liquidity_router tests
  • Add test verifying a swap succeeds within slippage tolerance
  • Add test verifying a swap reverts when price moves beyond slippage tolerance

Changes

  • dabdub_contracts/contracts/liquidity_router/src/test.rs (modify)
  • dabdub_contracts/contracts/liquidity_router/src/lib.rs (modify)
  • dabdub_contracts/contracts/liquidity_router/Cargo.toml (modify)
  • README.md (modify)
  • docs/abi/README.md (create)
  • .github/workflows/ci.yml (modify)

Approach

  1. [P1] slippage_protection: add integration with liquidity_router contract #1223 — [P1] slippage_protection: add integration with liquidity_router contract (Changed: dabdub_contracts/contracts/liquidity_router/src/lib.rs, dabdub_contracts/contracts/liquidity_router/src/test.rs, dabdub_contracts/contracts/liquidity_router/Cargo.toml)
  2. [P1] Add Soroban contract ABI documentation (JSON schemas) #1224 — [P1] Add Soroban contract ABI documentation (JSON schemas) (Changed: docs/abi/README.md, docs/abi/README.md, README.md, .github/workflows/ci.yml)
  3. [P1] liquidity_router: add slippage-protected swap test with real token mocks #1232 — [P1] liquidity_router: add slippage-protected swap test with real token mocks (Changed: dabdub_contracts/contracts/liquidity_router/src/lib.rs, dabdub_contracts/contracts/liquidity_router/src/test.rs)

Issues

Closes #1223
Closes #1224
Closes #1232

@drips-wave

drips-wave Bot commented Oct 22, 2026

Copy link
Copy Markdown

@charityagbenu12-cmd Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@martinzhames
martinzhames merged commit 94b712d into dupdab:main Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants