Skip to main content
SoroswapController supports Swap, AddLiquidity, and RemoveLiquidity through the configured Soroswap router. It validates the action/token combination and uses SmartAccount custody and contract authorization. Swap and add-liquidity input amounts are WAD. The remove-liquidity path accepts raw native LP units in its amount vector. Swap min_out is native output-token units. Add/remove pass min_out / 2 as each native leg minimum and use router deadlines; do not apply a single generic WAD interpretation to every argument. The controller sizes liquidity using committed reserve ratios, calls the router, synchronizes LP tracking membership, and returns signed WAD ledger deltas. Swap output credit is limited by accounted input and oracle value, so received token balance can exceed collateral credit. The testnet pair uses SoUSDC, not Blend USDC or AqUSDC. Exact addresses and pair configuration come from Registry and frontend configuration.

Function signatures

These signatures are copied from the reviewed Rust implementation. env is supplied by Soroban and is not a transaction argument. Result errors and panics must be handled by the caller; simulation does not guarantee later execution. Public methods include privileged and internal-contract callbacks, not just user entrypoints.

__constructor

upgrade

can_call

execute

get_registry

Source reference

  • Protocol_V1_Soroban_testnet/contracts/SoroswapControllerContract/src/controller.rs