Skip to content

[Bug] Zero slippage floor on the on-chain DeFindex adapter's deposit/withdraw #558

Description

@collinsezedike

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

  1. Have a MeridianVault routed through DefindexAdapter.
  2. Call deposit() or withdraw() while the underlying DeFindex vault's execution price is unfavorable (e.g. during unusual market conditions or a manipulated quote).
  3. 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programbugSomething isn't workingcontractsInvolves writing or testing Rust/Soroban contracts in packages/contractsmediumRequires familiarity with the Meridian codebase or relevant tooling; expect 4–8 hourssecuritySecurity hardening, vulnerability fixes, or audit-related worksorobanInvolves Soroban smart contract invocations or Soroban RPC calls

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions