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:
- Accepts XLM or USDC from the user's Stellar address.
- Executes a real on-chain swap via Stellar's built-in DEX (order book or liquidity pool path).
- Credits the output asset directly to the user's wallet.
- 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
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:
SwapExecutedevent the backend can index.Benefits
Stellar DEX path payment reference
References