Soroban smart contracts powering the CoopFinance cooperative finance platform.
| Contract | Description | Status |
|---|---|---|
treasury |
Group wallet — contributions, withdrawals, balance tracking | ✅ Testnet |
loan |
Loan request, disbursement, and repayment lifecycle | ✅ Testnet |
voting |
On-chain proposals and member voting | ✅ Testnet |
governance |
Cooperative rules engine (interest rates, quorum, etc.) | ✅ Testnet |
dividend |
Proportional profit distribution to members | ✅ Testnet |
- Rust
>=1.74withwasm32-unknown-unknowntarget - Stellar CLI
>=21.0
# Install Rust target
rustup target add wasm32-unknown-unknown
# Install Stellar CLI
cargo install --locked stellar-cli --features optgit clone https://github.com/coopfinance/coopfin-contracts
cd coopfin-contracts# Build all contracts
stellar contract build
# Or with cargo
cargo build --target wasm32-unknown-unknown --release# Run all tests
cargo test
# Run tests for a specific contract
cargo test -p coopfin-treasury
cargo test -p coopfin-loan
cargo test -p coopfin-voting# Fund a deployer account
stellar keys generate deployer
stellar keys fund deployer --network testnet
# Run deploy script
chmod +x scripts/deploy.sh
./scripts/deploy.sh testnet┌─────────────────────────────────────────────────────────────────┐
│ GovernanceContract │
│ Rules: min_contribution, loan_multiplier, quorum, interest │
└──────────────┬──────────────────────┬───────────────────────────┘
│ │
┌──────────▼──────────┐ ┌────────▼────────┐
│ TreasuryContract │ │ VotingContract │
│ - add_member │ │ - create_proposal│
│ - contribute │ │ - vote │
│ - withdraw │ │ - finalize │
└──────────┬──────────┘ └────────┬──────────┘
│ │
┌──────────▼──────────┐ ┌────────▼────────┐
│ LoanContract │ │ DividendContract │
│ - request_loan │ │ - distribute │
│ - approve_loan │ │ (proportional) │
│ - repay │ └─────────────────┘
└─────────────────────┘
Deploy with
./scripts/deploy.sh testnetand addresses are written todeployments/testnet.json.
This repo participates in the Stellar Drips Wave program. Merged PRs may earn XLM rewards. See CONTRIBUTING.md.
- All contracts use
require_auth()on every state-changing function - No reentrancy risk (Soroban execution model is single-threaded)
- Formal audit planned for mainnet launch
MIT