Description
DefindexAdapter::deposit/withdraw pass 0 as the minimum acceptable amount on both legs of their interaction with the underlying DeFindex vault, accepting any execution price the DeFindex vault happens to offer.
Closed issues #117 and #432 fixed the identical bug class, but only in packages/stellar-sdk-helpers/src/defindex.ts, the off-chain transaction builder. Neither touches the on-chain adapter that MeridianVault::deposit/withdraw actually invoke and which carries pooled depositor funds directly. The on-chain path still hardcodes a zero floor on both legs.
Steps to Reproduce
- Have a
MeridianVault routed through DefindexAdapter.
- Call
deposit() or withdraw() while the underlying DeFindex vault's execution price is unfavorable (e.g. during unusual market conditions or a manipulated quote).
- The adapter accepts whatever price results, since it passes
0 as the minimum on-chain.
Expected Behavior
The on-chain adapter should reject execution below a defined tolerance, the same protection already applied off-chain in the transaction builder.
Actual Behavior
Both deposit and withdraw pass a literal 0 minimum to the underlying DeFindex vault calls.
Environment
| Field |
Value |
| Network |
testnet / mainnet |
| Wallet |
N/A (contract-level) |
| Protocol affected |
DeFindex |
| Browser (if frontend) |
N/A |
| Node.js version |
N/A |
| pnpm version |
N/A |
Transaction Details (if on-chain)
- Transaction hash: N/A — identified by static review
- Ledger: N/A
- Soroban RPC endpoint used: N/A
Logs / Screenshots
defindex-adapter/src/lib.rs:94, 111-112
// both legs pass 0 as the minimum acceptable amount
Possible Cause / Fix
Apply a real basis-point tolerance (0.5% suggested) on both legs, matching the constraint #117 already established there: a floor set to the exact expected amount causes spurious reverts on ordinary rounding, so the tolerance needs headroom, not an exact match.
Scope
| Field |
Value |
| Area |
Contracts |
| Protocol affected |
DeFindex |
| Network |
testnet, mainnet |
| Breaking change? |
No — tightens accepted execution range only |
Description
DefindexAdapter::deposit/withdrawpass0as the minimum acceptable amount on both legs of their interaction with the underlying DeFindex vault, accepting any execution price the DeFindex vault happens to offer.Closed issues #117 and #432 fixed the identical bug class, but only in
packages/stellar-sdk-helpers/src/defindex.ts, the off-chain transaction builder. Neither touches the on-chain adapter thatMeridianVault::deposit/withdrawactually invoke and which carries pooled depositor funds directly. The on-chain path still hardcodes a zero floor on both legs.Steps to Reproduce
MeridianVaultrouted throughDefindexAdapter.deposit()orwithdraw()while the underlying DeFindex vault's execution price is unfavorable (e.g. during unusual market conditions or a manipulated quote).0as the minimum on-chain.Expected Behavior
The on-chain adapter should reject execution below a defined tolerance, the same protection already applied off-chain in the transaction builder.
Actual Behavior
Both
depositandwithdrawpass a literal0minimum to the underlying DeFindex vault calls.Environment
Transaction Details (if on-chain)
Logs / Screenshots
Possible Cause / Fix
Apply a real basis-point tolerance (0.5% suggested) on both legs, matching the constraint #117 already established there: a floor set to the exact expected amount causes spurious reverts on ordinary rounding, so the tolerance needs headroom, not an exact match.
Scope