clearledger-contracts README

The project's README from github.com/Stellar-Clear/clearledger-contracts. As one markdown file: README.md.

ClearLedger Soroban Contracts

Invoice-finance infrastructure built with Soroban on Stellar.

This Rust workspace implements ClearLedger’s on-chain coordination layer on Soroban, Stellar’s smart-contract platform. The contracts manage participant verification, invoice lifecycle transitions, USDC liquidity pools, and escrow operations, with application and SDK integrations built around Stellar’s contract interfaces and events.

Launch the Stellar Testnet app · Application repository · Stellar Testnet deployments · Soroban architecture · Deployment guide · Security policy

Contract system

Contract Responsibility
registry_contract Stores participant profiles and verification status for issuers and buyers.
invoice_contract Creates invoice records and enforces lifecycle transitions, including delivery confirmation and repayment.
pool_contract Accepts liquidity, issues transferable LP shares, funds eligible invoices, and accounts for repayment.
escrow_contract Holds funds during the funding flow and supports configured release and recovery operations.
pool_factory Supports deploying and tracking separate pool instances by asset.

The system coordinates on-chain state and token transfers. It does not validate the underlying commercial documents or establish that an invoice is legitimate.

Invoice lifecycle

Created → Listed → Funded → Active → Confirmed → Repaid
                              └──────────────────→ Defaulted

Participant verification and invoice status are checked on-chain at relevant transitions. The optional Underwrite agent registry integration is a separate dependency and must be configured for attestation-gated listing.

Testnet deployments

ClearLedger’s USDC contracts are live on Stellar Testnet. These Soroban contract IDs connect the application stack to Stellar’s test network; addresses may change when contracts are redeployed. See the deployment guide for address lifecycle details.

Contract Address
registry_contract CCGHK4XJA23BVPTADPCOUV76G2KYAAAKQIKPF35FN5RFP2TT47TXWQNT
invoice_contract CCZN4GM5O7D6RGI4P4FCKIB5HMRKDWOWY7M3YZ637XZFCGM7SXGIVAZ6
escrow_contract CC3EDR7B64Y5KZEJETATNVUWYGPHGUAR2V2QYTUCDOZJMYY3XEVAIGQB
pool_contract CDBJEGCV3IENZJKCK3LYYOSA7B5NZSPELBE7FPFHUKLG74LRJTCQIZ45

Inspect on Stellar Expert: Registry · Invoice · Escrow · Pool

Build and contribute

The workspace pins Rust 1.85.0 and the wasm32v1-none target in rust-toolchain.toml. Install the toolchain and Stellar CLI, then run:

rustup toolchain install 1.85.0
rustup target add wasm32v1-none --toolchain 1.85.0
cargo fmt --all --check
cargo clippy --all-targets --all-features -- -D warnings
cargo test --workspace
cargo build --workspace --release --target wasm32v1-none

For a fresh testnet deployment, configure .env using .env.example, fund a testnet deployer, then run:

bash scripts/setup-testnet.sh
bash scripts/deploy.sh

The deployment script supports resumable deployments and updates the address table above. See DEPLOYMENT.md for configuration, wiring, verification, and rollback details. The default deployment targets the supported USDC workflow; XLM deployment is experimental and opt-in.

Read CONTRIBUTING.md before opening a change. Architecture and integration references include the threat model, event catalog, storage schema, and known limitations.

Network and security

These contracts are deployed on Stellar Testnet and have not been formally audited. The current implementation has known functional and trust-model limitations, including an issuer payout path that is not yet wired into invoice funding. Review known limitations and SECURITY.md before integrating. Do not use real funds or treat testnet assets as redeemable value.

clearledger-contracts (Stellar-Clear/clearledger-contracts)

Searching Database…

What is this?ClearLedger is a Rust workspace of Soroban smart contracts on Stellar that power invoice-finance infrastructure: participant verification, invoice lifecycle, USDC liquidity pools, and escrow coordination.
Is this an app or a set of smart contracts?It's a Rust workspace containing five Soroban smart contracts that you deploy on-chain, not a standalone application; apps and SDKs integrate with them through Stellar's contract interfaces and events.
How do I build and deploy these contracts?Install the pinned Rust 1.85.0 toolchain with the wasm32v1-none target plus the Stellar CLI, then build; for a fresh testnet deploy, configure .env from .env.example, fund a testnet deployer, and run the resumable deployment script.
What do I need installed before building this?You need the Rust toolchain with the wasm32v1-none target configured via rust-toolchain.toml and the Stellar CLI; deploying additionally requires a funded Stellar Testnet account.
Is this safe to use with real money right now?No - it's only deployed on Stellar Testnet, has not been formally audited, and the issuer payout path isn't yet wired into invoice funding, so real funds or testnet assets should not be treated as redeemable value.
What does each of the five contracts actually do?registrycontract stores participant verification status, invoicecontract manages invoice lifecycle and repayment, poolcontract accepts liquidity and issues LP shares to fund invoices, escrowcontract holds funds during the funding flow, and poolfactory deploys and tracks separate pool instances per asset.
Can I deploy pools in XLM instead of USDC?The default deployment targets the supported USDC workflow; XLM deployment exists but is explicitly marked experimental and opt-in.
What is the Underwrite agent registry integration?It's an optional, separately configured dependency required only if you want attestation-gated invoice listing - the core contracts work without it.
Does the system verify that an invoice is a real, legitimate document?No - it only coordinates on-chain state and token transfers and explicitly does not validate underlying commercial documents or confirm an invoice's legitimacy.
Size
7.5 MB
Stars
131
Updated
CommitOct 09
Age
9d
Commits · 90 Days