Skip to content

feat: implement Soroban router contract for atomic vault rebalancing#299

Merged
collinsezedike merged 6 commits into
mainfrom
feat/soroban-router-contract
Jul 6, 2026
Merged

feat: implement Soroban router contract for atomic vault rebalancing#299
collinsezedike merged 6 commits into
mainfrom
feat/soroban-router-contract

Conversation

@collinsezedike

@collinsezedike collinsezedike commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Added packages/contracts/router/ with a MeridianRouter Soroban contract exposing a single rebalance(depositor, from_vault, to_vault, shares, min_out, route_to) entry point that withdraws from one Meridian vault and deposits into another within a single transaction.
  • depositor.require_auth() is called before any sub-invocations, so Soroban's auth tree enforces the depositor's signature over both legs atomically.
  • A slippage guard panics (reverting the whole transaction) when the withdrawal returns fewer stroops than min_out, ensuring the depositor cannot receive less than they specified.
  • A minimal VaultInterface trait drives the cross-contract calls via contractclient, so no vault WASM is compiled into the router.
  • Added two Rust unit tests using soroban-sdk::testutils: one verifies funds move correctly between vaults, the other confirms the slippage guard reverts as expected.
  • Updated scripts/deploy-testnet.sh to build and deploy the router alongside the vault contract.
  • Added docs/contracts.md documenting the contract interface, auth model, and slippage behaviour.
  • Updated packages/contracts/Cargo.toml to include the router as a workspace member.

Test plan

  • pnpm lint && pnpm typecheck && pnpm test pass locally
  • cargo test -p meridian-router passes with both test cases green
  • Slippage test panics with "slippage" message when min_out exceeds withdrawal amount
  • scripts/deploy-testnet.sh deploys the router and prints its contract ID without error

Closes #15

@vercel

vercel Bot commented Jun 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
meridian Ready Ready Preview, Comment Jul 5, 2026 6:39pm

@collinsezedike collinsezedike merged commit d8f66f1 into main Jul 6, 2026
8 checks passed
@collinsezedike collinsezedike deleted the feat/soroban-router-contract branch July 6, 2026 16:48
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.

[Contracts] Implement Soroban router contract for atomic vault rebalancing

1 participant