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…

这是什么?ClearLedger 是 Stellar 上由 Soroban 智能合约组成的 Rust 工作区,支撑发票融资基础设施:参与者验证、发票生命周期、USDC 流动性池和托管协调。
这是一个应用还是一组智能合约?它是一个包含五个 Soroban 智能合约的 Rust 工作区,这些合约由你部署到链上,并不是独立应用;应用和 SDK 通过 Stellar 的合约接口和事件与它们集成。
怎么构建和部署这些合约?安装固定版本的 Rust 1.85.0 工具链(带 wasm32v1-none 目标)和 Stellar CLI,然后构建;要在测试网全新部署,需参照 .env.example 配置 .env,给测试网部署者账户充值,再运行可断点续跑的部署脚本。
构建之前需要安装什么?你需要通过 rust-toolchain.toml 配置好的带 wasm32v1-none 目标的 Rust 工具链,以及 Stellar CLI;部署还需要一个有余额的 Stellar 测试网账户。
现在用真钱使用它安全吗?不安全——它只部署在 Stellar 测试网上,尚未经过正式审计,而且发行人付款路径尚未接入发票融资,因此真实资金或测试网资产都不应被视为可赎回的价值。
这五个合约各自实际做什么?registrycontract 存储参与者验证状态,invoicecontract 管理发票生命周期和还款,poolcontract 接收流动性并发行 LP 份额来为发票融资,escrowcontract 在融资流程中保管资金,poolfactory 按资产部署并跟踪独立的资金池实例。
可以用 XLM 而不是 USDC 来部署资金池吗?默认部署面向受支持的 USDC 工作流;XLM 部署虽然存在,但被明确标注为实验性、需主动启用。
Underwrite 智能体注册表集成是什么?它是一个可选、需单独配置的依赖,只有当你想要以证明为门槛的发票上架时才需要——核心合约没有它也能正常工作。
系统会验证发票是真实合法的单据吗?不会——它只协调链上状态和代币转移,明确不校验底层商业单据,也不确认发票的合法性。
Size
7.5 MB
Stars
131
Updated
CommitOct 09
Age
8d
Commits · 90 Days