Soroban smart contracts powering on-chain reputation, escrow and P2P lending on Stellar.
Live App · Docs · Product repo · Discussions · X
This repository contains the Soroban smart contracts behind Kredex, a peer-to-peer lending platform that replaces collateral with on-chain reputation. The contracts are live on Stellar Testnet, used by the product web app.
⚠️ Status: Testnet only. The contracts have not been independently audited. Do not use them with real funds.
| Contract | Crate | Purpose |
|---|---|---|
| Borrower Reputation | borrower_reputation |
Credit score, tiers, KYC tier, max loan and interest-rate calculation, freezing |
| Reputation NFT | reputation_nft |
Soulbound (non-transferable) badges for high-reputation borrowers |
| Lending | lending |
Loan requests, approvals, activation, repayment and default marking |
| Escrow | escrow |
Holds lender funds with a revocation window until disbursement |
| Default Management | default_management |
Default records and the insurance fund |
| Liquidity Pool | liquidity_pool |
Pooled deposits, allocation to loans, repayments |
| Oracle Adapter | oracle_adapter |
Price feeds for health checks |
Full function reference, deployed Testnet IDs and design notes: docs/CONTRACTS.md.
flowchart LR
B[Borrower] -->|create_loan_request| L[Lending]
L -->|get_profile / max loan| R[Borrower Reputation]
Lender -->|fund| E[Escrow]
E -->|confirm_disbursement| L
L -->|add_reputation_event| R
R -->|mint| N[Reputation NFT]
L -->|mark_defaulted| D[Default Management]
P[Liquidity Pool] -->|fund_from_pool| L
| Tool | Version | Install |
|---|---|---|
| Rust | stable | rustup.rs |
| WASM target | - | rustup target add wasm32-unknown-unknown |
| Stellar CLI | latest | Setup guide |
git clone https://github.com/kredex-org/contracts.git
cd contracts
# Run the whole workspace's tests
cargo test
# Build optimized WASM for every contract
cargo build --target wasm32-unknown-unknown --release
# Output: target/wasm32-unknown-unknown/release/*.wasmWork on a single contract:
cargo test -p borrower-reputationstellar keys generate my-admin --network testnet --fund
# See scripts/deploy.sh (macOS/Linux) or scripts/deploy.ps1 (Windows)Read the script before running it. Deployments use your own keys and cost nothing on Testnet. Never commit keys or
.envfiles.
contracts/
├─ borrower_reputation/ # score, tiers, KYC, profiles (has tests)
├─ reputation_nft/ # soulbound badges
├─ lending/ # loan lifecycle + interest_rate.rs
├─ escrow/ # holds & revocation window
├─ default_management/ # defaults + insurance fund
├─ liquidity_pool/ # LP deposits & allocation
├─ oracle_adapter/ # price feeds
├─ scripts/ # deploy.sh / deploy.ps1
├─ docs/ # contract reference
├─ Cargo.toml # workspace (soroban-sdk 22)
└─ Cargo.lock
We'd love your help, and tests are the best way in. Only borrower_reputation has a test suite so far, so every other contract has room for a valuable first contribution.
| Level | Ideas |
|---|---|
| 🌱 Beginner | Add doc comments to public functions, fix typos, improve this README, run tests on your OS and report issues |
| 🔧 Intermediate | Write unit tests for escrow, lending, liquidity_pool, oracle_adapter; add clippy fixes |
| 🦀 Advanced | Property/fuzz tests, review authorization and arithmetic, reduce WASM size, propose upgrade patterns |
Start with CONTRIBUTING.md, then look for good first issue. Not sure where to start? Ask in Discussions.
Found a vulnerability? Don't open a public issue. Use private vulnerability reporting. See the Security Policy.
MIT © Kredex Org