This document explains the contract CI system, supported contracts, and how to contribute new contracts to the StellarSplit project.
The StellarSplit project uses a dedicated CI script (contracts/scripts/ci-contracts.sh) to validate smart contracts before they are accepted into the supported set. This ensures that all contracts meet quality standards and compile correctly under the pinned Soroban toolchain.
- Script:
contracts/scripts/ci-contracts.sh - Purpose: Validates formatting, runs tests, and builds WASM for supported contracts
- Scope: Only contracts that compile cleanly are included in CI
# Run all checks (fmt + test + build) for all supported contracts
bash scripts/ci-contracts.sh all
# Run individual checks
bash scripts/ci-contracts.sh fmt # Check code formatting
bash scripts/ci-contracts.sh test # Run unit tests
bash scripts/ci-contracts.sh build # Build WASM binaries- Format Check: Ensures code follows Rust formatting standards
- Test Execution: Runs all unit tests for each contract
- WASM Build: Compiles contracts to WebAssembly for deployment
The following contracts are included in CI and must pass all checks:
| Contract | Status | Description |
|---|---|---|
achievement-badges |
Production | NFT achievement badges system |
dispute-resolution |
Production | On-chain dispute voting and escrow settlement |
flash-loan |
Production | Flash loan protocol implementation |
path-payment |
Production | Automatic currency conversion via Stellar path payments |
split-template |
Production | Reusable split templates with versioning |
staking |
Production | Staking, governance delegation, and reward distribution |
These contracts remain in the workspace for development but are excluded from CI:
| Contract | Status | Issue | Resolution Path |
|---|---|---|---|
split-escrow |
Experimental | Many compilation errors (draft/broken source) | Complete rewrite or major fixes needed |
multi-sig-splits |
Experimental | E0507 move error (needs ownership fix) | Fix ownership issues in Rust code |
Contracts that are no longer maintained:
| Contract | Status | Reason |
|---|---|---|
reminder |
Archived | Orphaned contract area; incomplete structure |
The contracts/Cargo.toml workspace includes:
[workspace]
members = [
# All contracts (including experimental)
"achievement-badges",
"flash-loan",
"dispute-resolution",
"path-payment",
"split-template",
"staking",
"split-escrow", # Experimental - excluded from CI
"multi-sig-splits", # Experimental - excluded from CI
]Key Points:
- Experimental contracts remain in workspace for dependency sharing
- Only supported contracts are included in
SUPPORTED_CONTRACTSarray in CI script - This allows local development while maintaining CI quality gates
- Create your contract directory under
contracts/ - Add to
contracts/Cargo.tomlmembers array - Implement contract with proper tests
- Ensure it compiles to WASM
Before submitting, run the full CI suite locally:
cd contracts
bash scripts/ci-contracts.sh allTo graduate a contract from experimental to supported:
- Fix All Compilation Issues: Contract must compile cleanly
- Add Comprehensive Tests: Ensure good test coverage
- Update CI Script: Add contract to
SUPPORTED_CONTRACTSarray - Update Documentation: Update status tables in README files
- Submit PR: Include CI script changes and documentation updates
Your pull request should include:
- Contract source code with tests
- Updated
contracts/Cargo.toml(if new contract) - Updated
scripts/ci-contracts.sh(if graduating to supported) - Updated documentation files:
contracts/README.mddocs/contract-ci.mdCONTRIBUTING.md
When developing experimental contracts:
- Add to Workspace: Include in
contracts/Cargo.tomlmembers - Do NOT Add to CI: Keep out of
SUPPORTED_CONTRACTSarray - Document Status: Clearly mark as experimental in documentation
- Track Issues: Document known problems and resolution path
- Formatting: Must pass
cargo fmt --all -- --check - Testing: Must have comprehensive unit tests
- Compilation: Must build cleanly for
wasm32-unknown-unknowntarget - Clippy: Should pass clippy lints (warnings acceptable for experimental)
Each contract should include:
- README.md: Contract purpose, usage, and API documentation
- Inline Documentation: Comprehensive code comments
- Test Documentation: Clear test descriptions and edge case coverage
The CI script is designed to integrate with GitHub Actions:
- name: Run Contract CI
run: |
cd contracts
bash scripts/ci-contracts.sh all- Make Changes: Edit contract code
- Run Local CI:
bash scripts/ci-contracts.sh all - Fix Issues: Address any formatting, test, or build failures
- Submit PR: Only submit when local CI passes
# Check specific contract compilation
cd contracts/your-contract
cargo build --target wasm32-unknown-unknown --release
# Check for detailed errors
cargo build --target wasm32-unknown-unknown --release --verbose# Run tests with output
cd contracts/your-contract
cargo test -- --nocapture
# Run specific test
cargo test test_function_name# Auto-fix formatting
cd contracts/your-contract
cargo fmt
# Check what would change
cargo fmt --all -- --check- Supported Contracts: Must always pass CI
- Experimental Contracts: May fail CI, but should be actively worked on
- Breaking Changes: Must not break existing supported contracts
- Dependencies: Use workspace dependencies when possible
- CI Validation: All supported contracts must pass CI
- Version Bump: Update contract versions if needed
- Documentation: Update all relevant documentation
- Release Tag: Create release tag with changelog
- CI Script: Maintained by core team
- Contract Updates: Original authors or assigned maintainers
- Documentation: Community contributions with core review
- Soroban Documentation: https://soroban.stellar.org/docs/
- Rust Book: https://doc.rust-lang.org/book/
- StellarSplit Repository: Issue tracking and discussions
- GitHub Issues: For bug reports and feature requests
- GitHub Discussions: For general questions and community support
- Core Team: For CI script and policy issues
The SUPPORTED_CONTRACTS array in scripts/ci-contracts.sh is the single source of truth for CI-supported contracts:
SUPPORTED_CONTRACTS=(
"achievement-badges"
"dispute-resolution"
"flash-loan"
"path-payment"
"split-template"
"staking"
)Common dependencies are managed at the workspace level:
[workspace.dependencies]
soroban-sdk = "21.0.0"This ensures version consistency across all contracts.