Soroban smart contracts for the Creditra adaptive credit protocol on Stellar.
This repo contains the credit contract: it will maintain credit lines, track utilization, enforce limits, and expose methods for opening lines, drawing, repaying, and updating risk parameters. The current code is a stub with the correct API and data types; full logic (storage, token transfers, interest) is to be implemented.
Contract data model:
CreditStatus: Active, Suspended, Defaulted, ClosedCreditLineData: borrower, credit_limit, utilized_amount, interest_rate_bps, risk_score, status
Methods: init, open_credit_line, draw_credit, repay_credit, update_risk_parameters, suspend_credit_line, close_credit_line.
- Rust (edition 2021)
- soroban-sdk (Stellar Soroban)
- Build target: wasm32 for Soroban
-
Rust 1.75+ (recommend latest stable)
-
wasm32target:rustup target add wasm32-unknown-unknown
-
Stellar Soroban CLI for deploy and invoke (optional for local build).
cd creditra-contracts
cargo build --release -p creditra-creditWASM output (after a typical Soroban setup) is under target/wasm32-unknown-unknown/release/creditra_credit.wasm (name may vary by crate name).
cargo test -p creditra-creditOnce the Soroban CLI and a network are configured:
soroban contract deploy --wasm target/wasm32-unknown-unknown/release/creditra_credit.wasm --source <identity> --network <network>See Stellar Soroban docs for details.
Cargo.toml— workspace and release profile (opt for contract size)contracts/credit/— credit line contractCargo.toml— crate config, soroban-sdk dependencysrc/lib.rs— contract types and impl (stubs)
This repo is a standalone git repository. After adding your remote:
git remote add origin <your-creditra-contracts-repo-url>
git push -u origin main