Soroban smart contracts for StableRoute — Stellar liquidity routing protocol.
- StableRouteRouter — Soroban contract placeholder for routing metadata and route integrity (version, route tags). Production logic will integrate with path payments and liquidity data.
- Rust (stable, with
rustfmt) - Optional: Soroban CLI for deployment
- Clone the repo and enter the directory:
git clone <repo-url> && cd stableroute-contracts
- Install Rust (if needed):
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh rustup component add rustfmt clippy rustup target add wasm32-unknown-unknown cargo install cargo-llvm-cov
- Build and test:
cargo build cargo clippy --all-targets -- -D warnings cargo test cargo build --target wasm32-unknown-unknown --release cargo llvm-cov --all-targets --fail-under-lines 95 - Check formatting:
cargo fmt --all -- --check
| Command | Description |
|---|---|
cargo build |
Build the contracts |
cargo test |
Run unit tests |
cargo clippy --all-targets -- -D warnings |
Treat Rust lints and warnings as CI failures |
cargo build --target wasm32-unknown-unknown --release |
Build the deployable Soroban WASM artifact |
cargo llvm-cov --all-targets --fail-under-lines 95 |
Report coverage and fail below 95 percent line coverage |
cargo fmt --all |
Format code |
cargo fmt --all -- --check |
CI: verify formatting |
On every push/PR to main, GitHub Actions runs:
cargo fmt --all -- --checkcargo buildcargo clippy --all-targets -- -D warningscargo testcargo build --target wasm32-unknown-unknown --releasecargo llvm-cov --all-targets --fail-under-lines 95
Ensure these pass locally before pushing.
- Fork the repo and create a branch from
main. - Make changes; keep formatting, linting, tests, WASM build, and coverage passing.
- Open a PR; CI must be green.
- Follow the project’s code style (enforced by
rustfmt).
require_admin — every admin-gated entrypoint in StableRouteRouter calls the private fn require_admin(env: &Env) -> Address helper instead of repeating the load-unwrap-require_auth block inline. When adding a new admin-gated entrypoint, start the body with Self::require_admin(&env);. Do not duplicate the pattern manually.
MIT