Skip to content

[FEATURE] Soroban swap contract: crypto trades happen off-chain with no on-chain proof #16

Description

@derbydaniels9-cpu

Summary

There is no Soroban contract for the crypto swap functionality. Currently, all XLM/USDC buy and sell operations happen off-chain — the backend simply updates database balance fields. This means swaps are not verifiable on-chain and users must trust the backend completely.

Proposed contract

A Soroban swap contract that:

  1. Accepts XLM or USDC from the user's Stellar address.
  2. Executes a real on-chain swap via Stellar's built-in DEX (order book or liquidity pool path).
  3. Credits the output asset directly to the user's wallet.
  4. Emits a SwapExecuted event the backend can index.

Benefits

  • Swaps are verifiable on Stellar explorer — full transparency.
  • Eliminates the backend as a trusted intermediary for the swap rate.
  • Users get the live market rate from Stellar DEX instead of the backend's hardcoded NGN_USD_RATE.

Stellar DEX path payment reference

// Soroban can invoke Stellar's path payment operation
Operation::path_payment_strict_send(
    send_asset: Asset::native(),   // XLM
    send_amount: amount,
    destination: user_address,
    dest_asset: USDC_asset,
    dest_min: min_receive,
    path: vec![],
)

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions