[Contracts] Add an admin-guarded rescue path for non-USDC tokens
Maintainers usually reply within 2 days
@ibochivincent-lang is already working on this.
Since Nov 20, 2026.
- #1403 by @ibochivincent-lang — open
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 54/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- rust
- Domain
- backend-api-design, security
Research direction
Start with the vault entry points in packages/contracts/vault/src/lib.rs, then read storage.rs and errors.rs to understand the existing admin checks and accounting. Add tests for authorization, protected addresses, invalid amounts, accounting invariants, and the success event; done means the acceptance criteria pass along with cargo test --workspace and cargo clippy --all-targets -- -D warnings.
Written by the indexing model from the issue text.
Description
Summary
The vault has no way to recover a token that a user sends to it by mistake. Any SEP-41 asset other than USDC or mUSDC that lands at the vault address is stuck.
Motivation
Mistaken transfers are a real support case. Without a rescue path the only recovery is a contract redeploy, and the vault is deliberately not upgradeable. A narrow admin function can recover unrelated tokens without touching user accounting.
Proposed Solution
Add an admin-only rescue_token(token, to, amount) entry point. Reject the vault's USDC, mUSDC, and the currently active adapter address. Do not change total shares, total assets, principal, entry time, or adapter accounting. Emit an admin event with the token, recipient, and amount. Require a positive amount and a sufficient balance, and cover authorization, protected addresses, and accounting invariants with tests.
Scope
| Field | Value |
|---|---|
| Area | Contracts |
| Protocol affected | None |
| Network | testnet and mainnet |
| Breaking change? | No |
Alternatives Considered
A pause-only rescue still leaves the vault unable to move an unrelated token while deposits are active. A generic sweep that includes USDC would create a direct path to user funds and is not acceptable.
Acceptance Criteria
- Only the admin can call the rescue entry point
- USDC, mUSDC, and the active adapter are rejected
- The call cannot change share or position accounting
- A successful rescue emits an admin event
- Tests cover authorization, protected tokens, zero and negative amounts, and a successful rescue
-
cargo test --workspaceandcargo clippy --all-targets -- -D warningspass
Additional Context
The vault entry points are in packages/contracts/vault/src/lib.rs, storage keys in storage.rs, and errors in errors.rs. The contract is intentionally not upgradeable, so this is a new deployment feature rather than a patch to a live instance.
- Dominant language
- TypeScript
- Stars
- 17
- Forks
- 129
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 54
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from drydocs/meridian
-
chore
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
drydocs/meridian#1503 · 1 comment ·
Maintainers usually reply within 2 days
-
[Docs] Add a supported wallet capability matrixPossibly taken @Joeljosef7 claimed this 4 days ago. Opendocs frontend Stellar Wave trivial
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
drydocs/meridian#1349 · 6 comments · 1 assignee ·
Maintainers usually reply within 2 days
-
[Test] Add cross-language conformance vectors for vault mathPossibly taken @VeronicDev claimed this 3 days ago. Opencontracts medium sdk Stellar Wave testing
drydocs/meridian#1444 · 5 comments · 1 assignee ·
Maintainers usually reply within 2 days
-
[Security] Extend CSP and security headers to landing and docs routesPossibly taken @anietie234 claimed this 3 days ago. Openapi frontend medium security Stellar Wave
drydocs/meridian#1443 · 5 comments · 1 assignee ·
Maintainers usually reply within 2 days
-
[Docs] Establish ADRs and backfill architecture decisionsPossibly taken @Sammydz456 claimed this 3 days ago. Opendocs medium Stellar Wave
drydocs/meridian#1442 · 5 comments · 1 assignee ·
Maintainers usually reply within 2 days
All issues in drydocs/meridian
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
External sources always come back in English: `lc` isn't passed to `/api/v3/external_sources`Possibly taken @Anurag1428 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
openfoodfacts/openfoodfacts-explorer#2264 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
cloudflare/workers-sdk#17139 ·
Maintainers usually reply within 1 day
-
area: editor P3 type: feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
halisonworks/mod-codeling#290 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
colinhacks/zod#6776 ·
Maintainers usually reply within 1 day