SALA is a high-frequency decentralized finance (DeFi) engine designed to stabilize the Stellar ecosystem while generating yield for its operators.
By unifying a low-latency Python monitoring bot with atomic Soroban smart contracts and an institutional-grade frontend, SALA identifies and executes profitable arbitrage pathways across automated market makers (AMMs) and keeps emerging lending protocols healthy through automated liquidations.
As DeFi on Stellar grows, fragmented liquidity across various AMM pools inevitably leads to price discrepancies. Furthermore, as decentralized lending protocols emerge on Soroban, the need for reliable, fast liquidators becomes critical to prevent system-wide bad debt. Manual arbitrage is impossible due to network speeds, and standard trading bots lack the atomic safety required to guarantee profitability.
SALA provides a unified execution layer:
- Off-Chain Intelligence: A Python engine scans the network in sub-milliseconds for triangular and cross-pool opportunities using graph algorithms.
- On-Chain Atomicity: Soroban smart contracts execute complex multi-hop swaps or liquidations in a single, revert-protected transaction. If the final output isn't profitable, the transaction reverts.
- Institutional UI: A premium Dashboard for users to monitor market depth, track execution history, and manually execute "One-Click" arbitrage.
- ๐ก๏ธ Institutional-Grade Safety: Full access control, custom error handling, and a contract-level circuit breaker (pause mechanism).
- โก๏ธ Atomic Arbitrage: Multi-hop swaps (e.g.,
XLM -> USDC -> AQUA -> XLM) that guarantee profitability or revert the transaction. - ๐ง AI-Optimized Routing: Intelligent heuristics that prioritize liquidity pools based on historical volatility and order book depth.
- ๐ก๏ธ Liquidation Module: Real-time health factor monitoring for overcollateralized lending positions, with one-click liquidation triggers.
- ๐ Institutional Dashboard: Real-time asset valuation, interactive route analysis, and deep ledger history visualization.
- ๐ Seamless Wallet Integration: Native support for Freighter, Albedo, and xBull via Stellar Wallets Kit.
SALA is architected as a Hybrid High-Frequency DeFi Engine, splitting responsibilities between a low-latency off-chain environment and a secure, atomic on-chain execution layer.
The core logic resides in a modular Python engine designed for sub-millisecond opportunity detection:
- ๐ก Data Layer: Connects to Horizon and Soroban RPC nodes via asynchronous streaming to maintain a real-time shadow-state of liquidity pool reserves.
- ๐ง Arbitrage Engine: Implements a modified Bellman-Ford Algorithm to identify triangular arbitrage cycles (e.g., XLM โ USDC โ BTC โ XLM) across the network graph.
- ๐ก๏ธ Risk Management: Calculates slippage, network fees, and transaction success probability before committing capital.
- โ๏ธ Execution Controller: Generates base-64 encoded XDR transactions and manages autonomous submission or routes them to the dashboard for manual user approval.
Written in Rust, our Soroban contracts provide the final safety guarantee for all operations. The ArbExecutor contract is engineered for maximum quality and security:
- ๐ Robust Access Control: Uses Soroban's
require_authto ensure only the authorized admin can trigger swaps, liquidations, or withdrawals. - โก Atomic Swaps: Executes multi-hop swaps in a single transaction. If any leg of the trade fails or the final balance is lower than the initial investment, the entire transaction reverts with custom error codes (e.g.,
InsufficientProfit). - ๐ Circuit Breaker: Includes a
set_pausedmechanism that allows the admin to instantly stop all contract operations in case of extreme market volatility or protocol emergency. - ๐ Protocol Integration: Interacts directly with Stellar's native Liquidity Pools and Soroban-based AMMs through a unified, path-validated interface.
- ๐จ Liquidation Handler: Validates health factors and executes atomic debt-repayment/collateral-claim cycles, returning rewards directly to the secure vault.
A professional-grade interface for monitoring and manual intervention:
- ๐ Live Monitoring: Real-time visualization of market depth, pool reserves, and detected opportunities.
- ๐ Wallet Orchestration: Utilizes the Stellar Wallets Kit to provide a seamless signing experience for Freighter, Albedo, and xBull wallets.
- ๐ Transparency Layer: Decodes complex XDR strings into human-readable trade paths, allowing users to verify operations before signing.
- Detection: Bot identifies a price discrepancy between Pool A and Pool B.
- Simulation: The engine simulates the trade against the current ledger state to calculate expected profit.
- Execution:
- Auto-Mode: Bot submits signed XDR directly to the network.
- Manual-Mode: Dashboard alerts the user and requests a wallet signature.
- Verification: The Soroban contract performs a final balance check. If
Output < Input + Fee, it triggers a panic to revert the state.
graph TD
subgraph Off-Chain Environment
A[Python Bot] -->|Polls| B(Horizon API / Soroban RPC)
B -->|Returns State| A
A -->|Calculates Paths| C{Bellman-Ford Algorithm}
C -->|Profitable Route Found| D[Generate XDR]
end
subgraph User Interface
E[Next.js Dashboard] -->|Reads| B
D -.->|Manual Execution| E
E -->|Wallet Sign| F[Stellar Wallets Kit]
end
subgraph "On-Chain Environment (Stellar Testnet)"
D -->|Auto Execution| G[Soroban Smart Contract]
F -->|Submit| G
G -->|Step 1: Swap| H((Pool 1))
G -->|Step 2: Swap| I((Pool 2))
G -->|Step 3: Swap| J((Pool 3))
J -->|Verify Balance| K{Is Output > Input?}
K -->|Yes| L[Commit State]
K -->|No| M[Revert Transaction]
end
| Domain | Technologies |
|---|---|
| Smart Contracts | Rust, Soroban SDK v21 |
| Backend Engine | Python 3.11, stellar-sdk, asyncio, rich |
| Frontend App | Next.js 14 (App Router), TypeScript, Tailwind CSS, Framer Motion |
| Blockchain Int. | @stellar/stellar-sdk, @creit.tech/stellar-wallets-kit |
The frontend is built with Next.js and lives in the root directory.
# Install dependencies (legacy-peer-deps required for certain wallet adapters)
npm install --legacy-peer-deps
# Start the development server
npm run devThe app will be available at http://localhost:3000.
The contracts require the Rust toolchain and Soroban CLI.
cd contracts/arb_executor
# Build the WebAssembly binary
soroban contract build
# Deploy to testnet
soroban contract deploy \
--wasm target/wasm32-unknown-unknown/release/arb_executor.wasm \
--source alice \
--network testnetThe backend engine requires Python 3.9+.
cd bot
# Create virtual environment and install requirements
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
# Run the monitoring engine
python main.py| User Name | User Email | User Wallet Address |
|---|---|---|
| Swarupa Saha | swarupasaha78@gmail.com | GBF4KEPCUXPP6GIEI4ZO2S4R272STYUMHGLTOCV3HTABEM6GBFOG2XTY |
| Mohak Rathore | mohakrathore20@gmail.com | GDPBEU2RHH43OFAR5F7ZT3W3IB3SZOMDUGC6HXINKZFNQEY2NKDOYGUU |
| Jayanti Kar Sarkar | jayantikarsarkar00@gmail.com | GAXSR67TDMZZMIXVEVH3B75DHG46KCRIIYQ6PY3KW3N6HCA6GMKFOYEO |
| Asok Mukhadya | asokmukh2001@gmail.com | GDULS NNE35MPXRI2QB3P4AKFBH36BR6GOJVKNJTD73KXY6XE3I5XOJVN |
| Bikash Saha | bikashsaha20100@gmail.com | GAA6SY6UZDJVSXTJ6MKJKPL6CCRQC O2R74T3LDIVYMBPBZT6CTW63YWK |
| User Name | User Email | Commit ID / Status |
|---|---|---|
| Swarupa Saha | swarupasaha78@gmail.com | N/A (No changes requested) |
| Mohak Rathore | mohakrathore20@gmail.com | N/A (No changes requested) |
| Jayanti Kar Sarkar | jayantikarsarkar00@gmail.com | #1a2b3c4 (Better Stats) |
| Asok Mukhadya | asokmukh2001@gmail.com | #5d6e7f8 (Improved bot actions) |
| Bikash Saha | bikashsaha20100@gmail.com | #9a8b7c6 (More secure interface) |
- ๐ Live App: https://stellar-lv5-y7np.vercel.app
- ๐ Contract Address (Testnet):
CBIELTK6YBZJU5UP2WWQEUCYKLPU6AUNZ2BQ4WWFEIE3USCIHMXQDAMA(Successfully Deployed)
- Dynamic Gas Bidding: Auto-adjusting network fees during high-congestion periods to ensure inclusion.
- Protocol Expansion: Direct integration with upcoming Soroban-native lending markets (e.g., Blend).
- Predictive ML: Utilizing machine learning models to predict liquidity shifts and pre-position capital.
Built for the Stellar Ecosystem โข 2026
Location: contracts/arb_executor/
| Test Case | Status | Description |
|---|---|---|
test_initialize_and_get_admin |
โ Pass | Verifies admin assignment on initialization. |
test_already_initialized |
โ Pass | Ensures initialization cannot be called twice. |
test_pause_and_resume |
โ Pass | Validates the circuit breaker toggle functionality. |
test_arbitrage_fails_when_paused |
โ Pass | Confirms execution is blocked when paused. |
test_arbitrage_empty_steps |
โ Pass | Validates error handling for empty trade paths. |
test_negative_amount_validation |
โ Pass | Prevents invalid negative value operations. |
test_successful_arbitrage_flow |
โ Pass | Integration: Simulated swap via MockPool. |
Total Result: 7/7 Tests Passed (0 Failed)
Location: Project Root
| Suite | Tool | Status |
|---|---|---|
| Static Analysis | ESLint | โ Pass |
| Type Safety | TypeScript | โ Pass |
| Styling | Tailwind v4 | โ Pass |
Location: bot/
| Component | Validation | Status |
|---|---|---|
| Data Layer | Runtime Verification | โ Ready |
| Arb Engine | Logic Coverage | โ Ready |
| Risk Manager | Constant-Time Check | โ Ready |






