Secure, transparent, and decentralized trading powered by Soroban on the Stellar network.
SwapTrade is an open-source decentralized exchange (DEX) smart contract suite built with Soroban, the smart contract platform for the Stellar network. It provides the core building blocks for creating, managing, and settling token trades in a secure and trustless environment while leveraging Stellar's fast settlement and low transaction costs.
Designed with modularity and extensibility in mind, SwapTrade serves as a foundation for developers building decentralized finance (DeFi) applications on Stellar. The project emphasizes security, transparency, and developer experience, making it suitable for contributors, auditors, and ecosystem builders alike.
- Introduction
- Features
- Architecture
- Installation
- Project Structure
- Building the Contract
- Running Tests
- Deployment
- Usage
- Contributing
- Security
- Roadmap
- FAQ
- License
Traditional exchanges depend on centralized operators to custody assets and execute trades. SwapTrade replaces that model with Soroban smart contracts that execute trading logic directly on-chain.
With SwapTrade:
- Assets remain under users' control until execution.
- Trading rules are enforced by immutable smart contracts.
- Every transaction is transparent and verifiable.
- Developers can extend the protocol for new DeFi applications.
- Anyone can integrate the contracts into wallets, marketplaces, or trading interfaces.
| Feature | Description |
|---|---|
| 🔄 Decentralized Trading | Execute token trades directly through Soroban smart contracts. |
| 🔐 Secure Execution | Contract logic validates every trade before settlement. |
| ⚡ Fast Settlement | Leverages Stellar's efficient consensus for quick confirmations. |
| 💸 Low Fees | Designed for cost-effective on-chain trading. |
| 🧩 Modular Design | Contracts are easy to extend and integrate into other protocols. |
| 📜 Transparent | Every trade is recorded on-chain for public verification. |
| 🧪 Fully Tested | Comprehensive Rust unit and integration tests. |
| 🌍 Open Source | Community-driven development under the MIT License. |
SwapTrade follows a modular architecture that separates business logic into reusable components.
swaptrade/
├── contracts/
│ ├── swap/
│ ├── token/
│ └── shared/
│
├── src/
│ ├── storage.rs
│ ├── events.rs
│ ├── errors.rs
│ ├── authorization.rs
│ └── lib.rs
│
├── tests/
├── scripts/
├── Cargo.toml
└── README.md
Each module has a single responsibility, making the project easier to maintain, audit, and extend.
Before getting started, install the following tools:
- Rust (latest stable)
- Cargo
- Soroban CLI
- Stellar CLI
- Git
Verify your installation:
rustc --version
cargo --version
soroban --version
stellar --versiongit clone https://github.com/your-org/swaptrade.git
cd swaptradeCompile the project:
cargo build --releaseTo build the WebAssembly artifact used for deployment:
cargo build \
--target wasm32v1-none \
--releasecontracts/
│
├── swap/
│ Trading contract
│
├── shared/
│ Shared utilities
│
├── interfaces/
│ Public contract interfaces
│
├── token/
│ Token interactions
│
└── tests/
Integration tests
The project follows common Rust workspace conventions to make development familiar for contributors already working within the Stellar ecosystem.