This directory contains the Soroban smart contracts for the StellarSplit escrow system.
The StellarSplit contracts handle on-chain escrow for bill splitting, enabling trustless payments between participants.
contracts/
├── achievement-badges/ # NFT achievement badges
│ ├── src/
│ │ ├── lib.rs # Badge minting contract
│ │ ├── types.rs # Badge types and metadata
│ │ ├── storage.rs # Badge storage helpers
│ │ ├── events.rs # Badge events
│ │ └── test.rs # Badge tests
│ ├── Cargo.toml # Rust dependencies
│ └── README.md # Badge contract docs
├── multi-sig-splits/ # Multi-signature with time-locks
│ ├── src/
│ │ ├── lib.rs # Multi-sig contract
│ │ ├── types.rs # Multi-sig types
│ │ ├── storage.rs # Multi-sig storage
│ │ ├── events.rs # Multi-sig events
│ │ └── test.rs # Multi-sig tests
│ ├── Cargo.toml # Rust dependencies
│ └── README.md # Multi-sig contract docs
├── split-escrow/ # Main escrow contract
│ ├── src/
│ │ ├── lib.rs # Contract entry point
│ │ ├── types.rs # Custom data types
│ │ ├── storage.rs # Storage helpers
│ │ ├── events.rs # Contract events
│ │ └── test.rs # Unit tests
│ ├── Cargo.toml # Rust dependencies
│ └── README.md # Contract documentation
├── scripts/
│ ├── build.sh # Build split-escrow contract
│ ├── build-achievement-badges.sh # Build achievement badges contract
│ ├── build-multi-sig-splits.sh # Build multi-sig splits contract
│ ├── deploy.sh # Deploy to network
│ └── test.sh # Run unit tests
└── README.md # This file
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source ~/.cargo/envrustup target add wasm32-unknown-unknowncargo install soroban-clicd contracts
# Build main escrow contract
./scripts/build.sh
# Build achievement badges contract
./scripts/build-achievement-badges.sh
# Build multi-signature contract
./scripts/build-multi-sig-splits.shEach script compiles the respective contract to WebAssembly and optionally optimizes it.
./scripts/test.shRun specific tests:
./scripts/test.sh create_split
./scripts/test.sh --verbose-
Set your admin secret key:
export ADMIN_SECRET_KEY='S...your_secret_key...'
-
Deploy:
./scripts/deploy.sh testnet
-
Save the returned Contract ID for future interactions.
./scripts/deploy.sh mainnet| Network | RPC URL | Description |
|---|---|---|
| Testnet | https://soroban-testnet.stellar.org | Free test tokens available |
| Mainnet | https://soroban.stellar.org | Production environment |
Use the Stellar Laboratory to fund a testnet account.
| Function | Description |
|---|---|
initialize(admin) |
Set up the contract with an admin |
create_split(...) |
Create a new bill split |
deposit(split_id, participant, amount) |
Deposit funds into a split |
release_funds(split_id) |
Release collected funds to creator |
cancel_split(split_id) |
Cancel a split |
get_split(split_id) |
Query split details |
The contract emits these events for off-chain tracking:
init- Contract initializedcreated- Split createddeposit- Funds depositedreleased- Funds releasedcancel- Split cancelledrefund- Refund processed
split-escrow/
├── Cargo.toml # Dependencies and build config
└── src/
├── lib.rs # Main contract + public interface
├── types.rs # Split, Participant, SplitStatus
├── storage.rs # DataKey enum + storage helpers
├── events.rs # Event emission functions
└── test.rs # Unit tests
cd split-escrow
cargo test test_create_split
cargo test test_deposit -- --nocapturecargo clippy --target wasm32-unknown-unknown- Admin Keys: Never commit secret keys to version control
- Authorization: All sensitive operations require
require_auth() - Input Validation: All inputs are validated before processing
- State Checks: Operations verify split status before proceeding
MIT License - see LICENSE for details.