Soroban smart contracts for LiquiFact — the global invoice liquidity network on Stellar. This repo contains the escrow contract that holds investor funds for tokenized invoices until settlement.
Part of the LiquiFact stack: frontend (Next.js) | backend (Express) | contracts (this repo).
- Rust 1.70+ (stable)
- Soroban CLI (optional, for deployment): Stellar Soroban docs
For CI and local checks you only need Rust and cargo.
-
Clone the repo
git clone <this-repo-url> cd liquifact-contracts
-
Build
cargo build
-
Run tests
cargo test
| Command | Description |
|---|---|
cargo build |
Build all contracts |
cargo test |
Run unit tests |
cargo fmt |
Format code |
cargo fmt -- --check |
Check formatting (used in CI) |
liquifact-contracts/
├── Cargo.toml # Workspace definition
├── escrow/
│ ├── Cargo.toml # Escrow contract crate
│ └── src/
│ ├── lib.rs # LiquiFact escrow contract (init, fund, settle)
│ └── test.rs # Unit tests
└── .github/workflows/
└── ci.yml # CI: fmt, build, test
- init — Create an invoice escrow (invoice id, SME address, amount, yield bps, maturity).
- get_escrow — Read current escrow state.
- fund — Record investor funding; status becomes “funded” when target is met.
- settle — Mark escrow as settled (buyer paid; investors receive principal + yield).
GitHub Actions runs on every push and pull request to main:
- Format —
cargo fmt --all -- --check - Build —
cargo build - Tests —
cargo test
Keep formatting and tests passing before opening a PR.
- Fork the repo and clone your fork.
- Create a branch from
main:git checkout -b feature/your-featureorfix/your-fix. - Setup: ensure Rust stable is installed; run
cargo buildandcargo test. - Make changes:
- Follow existing patterns in
escrow/src/lib.rs. - Add or update tests in
escrow/src/test.rs. - Format with
cargo fmt.
- Follow existing patterns in
- Verify locally:
cargo fmt --all -- --checkcargo buildcargo test
- Commit with clear messages (e.g.
feat(escrow): X,test(escrow): Y). - Push to your fork and open a Pull Request to
main. - Wait for CI and address review feedback.
We welcome new contracts (e.g. settlement, tokenization helpers), tests, and docs that align with LiquiFact’s invoice financing flow.
MIT (see root LiquiFact project for full license).