Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 8 additions & 56 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,71 +36,23 @@ jobs:
cargo update darling_macro@0.23.0 --precise 0.21.3 || true
cargo update indexmap@2.14.0 --precise 2.6.0 || true

- name: Build contracts
working-directory: smartcontract
run: |
cargo build --target wasm32-unknown-unknown --release --manifest-path=contracts/factory/Cargo.toml
cargo build --target wasm32-unknown-unknown --release --manifest-path=contracts/rotational/Cargo.toml
cargo build --target wasm32-unknown-unknown --release --manifest-path=contracts/target/Cargo.toml
cargo build --target wasm32-unknown-unknown --release --manifest-path=contracts/flexible/Cargo.toml

- name: Install Stellar CLI
run: cargo install stellar-cli

- name: Import deployer key
run: |
stellar keys add deployer --secret-key <<< "${{ secrets.DEPLOYER_SECRET_KEY }}"

- name: Deploy Factory contract
id: factory
working-directory: smartcontract
run: |
FACTORY_ID=$(stellar contract deploy \
--wasm target/wasm32-unknown-unknown/release/jointsave_factory.wasm \
--source deployer \
--network testnet)
echo "factory_id=$FACTORY_ID" >> $GITHUB_OUTPUT
echo "Factory: $FACTORY_ID"

- name: Upload Rotational wasm
id: rotational
- name: Execute Unified 9-Contract Deployment
working-directory: smartcontract
env:
STELLAR_SOURCE: deployer
STELLAR_NETWORK: testnet
run: |
HASH=$(stellar contract upload \
--wasm target/wasm32-unknown-unknown/release/jointsave_rotational.wasm \
--source deployer \
--network testnet)
echo "hash=$HASH" >> $GITHUB_OUTPUT
echo "Rotational hash: $HASH"
chmod +x scripts/deploy.sh scripts/verify.sh
./scripts/deploy.sh

- name: Upload Target wasm
id: target
- name: Verify All 9 Contracts On-Chain
working-directory: smartcontract
run: |
HASH=$(stellar contract upload \
--wasm target/wasm32-unknown-unknown/release/jointsave_target.wasm \
--source deployer \
--network testnet)
echo "hash=$HASH" >> $GITHUB_OUTPUT
echo "Target hash: $HASH"

- name: Upload Flexible wasm
id: flexible
working-directory: smartcontract
run: |
HASH=$(stellar contract upload \
--wasm target/wasm32-unknown-unknown/release/jointsave_flexible.wasm \
--source deployer \
--network testnet)
echo "hash=$HASH" >> $GITHUB_OUTPUT
echo "Flexible hash: $HASH"

- name: Print deployment summary
run: |
echo "========================================"
echo "Deployment complete. Add to frontend/.env:"
echo "========================================"
echo "NEXT_PUBLIC_FACTORY_CONTRACT_ID=${{ steps.factory.outputs.factory_id }}"
echo "NEXT_PUBLIC_ROTATIONAL_WASM_HASH=${{ steps.rotational.outputs.hash }}"
echo "NEXT_PUBLIC_TARGET_WASM_HASH=${{ steps.target.outputs.hash }}"
echo "NEXT_PUBLIC_FLEXIBLE_WASM_HASH=${{ steps.flexible.outputs.hash }}"
./scripts/verify.sh deployments/stellar-testnet.json
12 changes: 12 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,18 @@ jobs:
working-directory: smartcontract
run: cargo build --target wasm32-unknown-unknown --release --manifest-path=contracts/governance/Cargo.toml

- name: Build Reputation contract
working-directory: smartcontract
run: cargo build --target wasm32-unknown-unknown --release --manifest-path=contracts/reputation/Cargo.toml

- name: Build Microloan contract
working-directory: smartcontract
run: cargo build --target wasm32-unknown-unknown --release --manifest-path=contracts/microloan/Cargo.toml

- name: Build Yield Strategy contract
working-directory: smartcontract
run: cargo build --target wasm32-unknown-unknown --release --manifest-path=contracts/yield-strategy/Cargo.toml

- name: Build Yield Vault contract
working-directory: smartcontract
run: cargo build --target wasm32-unknown-unknown --release --features mock --manifest-path=contracts/yield-vault/Cargo.toml
Expand Down
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,21 @@ A full technical walkthrough — contract layer, flows, and database schema —

The codebase ships a **9-contract Soroban suite**. The following are deployed/uploaded on **Stellar Testnet**:

| Contract | Address |
| Contract | Address / Hash |
| ------------------- | ------------------------------------------------------------------ |
| **Factory** | `CBZNGP52FLFZ4BOGC265FUAMP5KFMAYPQK3KTI5UHMYVMM3QCST3IMRI` |
| **Reputation** | `CCVZ43L4INMEXD6VECM4VZBGPHFFVOWY6BBCDU2VYV6PPXLV5SZAS6MF` |
| **Governance** | `CDPCNYHPV3H7O4B5EI7EJG5EK6N4CTRFFTCTSKRP4F6UQ2JR33QUGHF7` |
| **Microloan** | `CB7WSC4AVUP4ZFLHO2DIUWL2OR7I4ZQI5N72L2KYQAS6D5BVUNTMIX3V` |
| **Yield Vault** | `CAT7EL6WMHJHXZB5CPPDTPO6E73WBQOXOBMMIZPNF2Z6M7VJSLWZMIYX` |
| **Yield Strategy** | `CATFNUIXU3YIAOZHCMAH4FLLN2NNPYPK4YXWMCL6MJPAOLOHO5AX32KH` |
| **Rotational WASM** | `d350a325d8734263a3d7150c875555d8956e13a527fb3497d5141b8b3f3d2c74` |
| **Target WASM** | `133a62226501fc5443e70007d79deeeb0b33fdf8c85c7fcd3cf16293bb5c7292` |
| **Flexible WASM** | `df6ff088fd79f13d8d03e72160434517fdb4a83b8c7bfdd887be4369805e0d6b` |

_Deployed on April 16, 2026 — see [`smartcontract/deployments/stellar-testnet.json`](smartcontract/deployments/stellar-testnet.json) for the source of truth._
_Verified on Stellar Testnet — see [`smartcontract/deployments/stellar-testnet.json`](smartcontract/deployments/stellar-testnet.json) for the source of truth._

The full suite also includes **governance**, **microloan**, **reputation**, **yield-strategy**, and **yield-vault** contracts. Reputation and the mock yield-vault are deployed by [`smartcontract/scripts/deploy.sh`](smartcontract/scripts/deploy.sh); governance, microloan, yield-strategy, and the yield-vault have no testnet deployment recorded yet. Microloan and reputation are feature-gated through the `NEXT_PUBLIC_MICROLOAN_CONTRACT_ID` / `NEXT_PUBLIC_REPUTATION_CONTRACT_ID` env vars (leave blank to disable).
The full 9-contract suite is deployed, initialized, and verified on Stellar testnet. All contract IDs and template WASM hashes can be verified with `./smartcontract/scripts/verify.sh`. Microloan and reputation features are configured via `NEXT_PUBLIC_MICROLOAN_CONTRACT_ID` and `NEXT_PUBLIC_REPUTATION_CONTRACT_ID`.

For complete API documentation — functions, events, storage keys, error conditions, and CLI examples — see **[docs/contract-api.md](docs/contract-api.md)**.

Expand Down Expand Up @@ -276,7 +281,7 @@ _Automated testing and deployment_
- **DeFi Integration** – Connect flexible pools to Stellar DeFi protocols for yield (yield-strategy contract scaffolded; wire liquidity paths)
- **Advanced Analytics** – Protocol-wide analytics dashboard (telemetry + insights beyond per-pool health)
- **Group Communication** – In-app messaging and notifications
- **Mainnet Hardening** – Deploy the 9-contract suite to Stellar mainnet (governance, microloan, yield-strategy, and the yield vault still have no testnet deployment recorded)
- **Mainnet Hardening** – Deploy the 9-contract suite to Stellar mainnet with production key custody (full 9-contract suite already verified on testnet)
- **Admin Emergency Console** – Self-service pause/resume/emergency-withdraw UI with SEP-53 proof (backend exists; UI on the way)

### 🌍 Phase 3 - Scale
Expand Down
17 changes: 17 additions & 0 deletions docs/contract-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,25 @@ Complete API reference for the four Soroban contracts powering JointSave on Stel

---

## Verified Testnet Deployments

| Contract | Address / WASM Hash | Status |
| ------------------- | ------------------------------------------------------------------ | -------- |
| **Factory** | `CBZNGP52FLFZ4BOGC265FUAMP5KFMAYPQK3KTI5UHMYVMM3QCST3IMRI` | Verified |
| **Reputation** | `CCVZ43L4INMEXD6VECM4VZBGPHFFVOWY6BBCDU2VYV6PPXLV5SZAS6MF` | Verified |
| **Governance** | `CDPCNYHPV3H7O4B5EI7EJG5EK6N4CTRFFTCTSKRP4F6UQ2JR33QUGHF7` | Verified |
| **Microloan** | `CB7WSC4AVUP4ZFLHO2DIUWL2OR7I4ZQI5N72L2KYQAS6D5BVUNTMIX3V` | Verified |
| **Yield Vault** | `CAT7EL6WMHJHXZB5CPPDTPO6E73WBQOXOBMMIZPNF2Z6M7VJSLWZMIYX` | Verified |
| **Yield Strategy** | `CATFNUIXU3YIAOZHCMAH4FLLN2NNPYPK4YXWMCL6MJPAOLOHO5AX32KH` | Verified |
| **Rotational WASM** | `d350a325d8734263a3d7150c875555d8956e13a527fb3497d5141b8b3f3d2c74` | Verified |
| **Target WASM** | `133a62226501fc5443e70007d79deeeb0b33fdf8c85c7fcd3cf16293bb5c7292` | Verified |
| **Flexible WASM** | `df6ff088fd79f13d8d03e72160434517fdb4a83b8c7bfdd887be4369805e0d6b` | Verified |

---

## Table of Contents

- [Verified Testnet Deployments](#verified-testnet-deployments)
- [Factory Contract](#factory-contract)
- [Rotational Pool Contract](#rotational-pool-contract)
- [Target Pool Contract](#target-pool-contract)
Expand Down
19 changes: 14 additions & 5 deletions frontend/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,21 @@ NEXT_PUBLIC_TOKEN_CONTRACT_ID=native
# USDC contract (see lib/token-utils.ts) when unset.
NEXT_PUBLIC_USDC_CONTRACT_ID=CBIELTK6YBZJU5UP2WWQEUCYKLPU6AUNZ2BQ4WWFEIE3USCIHMXQDAMA

# Optional reputation contract ID. Leave blank to disable the additive reputation system.
NEXT_PUBLIC_REPUTATION_CONTRACT_ID=
# Reputation contract ID deployed on Stellar testnet (verified in smartcontract/deployments/stellar-testnet.json).
NEXT_PUBLIC_REPUTATION_CONTRACT_ID=CCVZ43L4INMEXD6VECM4VZBGPHFFVOWY6BBCDU2VYV6PPXLV5SZAS6MF

# Optional microloan contract ID. Leave blank to disable the P2P lending marketplace.
# Deploy smartcontract/contracts/microloan to testnet and paste the contract ID here.
NEXT_PUBLIC_MICROLOAN_CONTRACT_ID=
# Microloan contract ID deployed on Stellar testnet (verified in smartcontract/deployments/stellar-testnet.json).
NEXT_PUBLIC_MICROLOAN_CONTRACT_ID=CB7WSC4AVUP4ZFLHO2DIUWL2OR7I4ZQI5N72L2KYQAS6D5BVUNTMIX3V

# Governance contract ID deployed on Stellar testnet (verified in smartcontract/deployments/stellar-testnet.json).
NEXT_PUBLIC_GOVERNANCE_CONTRACT_ID=CDPCNYHPV3H7O4B5EI7EJG5EK6N4CTRFFTCTSKRP4F6UQ2JR33QUGHF7

# Mock Yield Vault contract ID deployed on Stellar testnet (verified in smartcontract/deployments/stellar-testnet.json).
NEXT_PUBLIC_YIELD_VAULT_CONTRACT_ID=CAT7EL6WMHJHXZB5CPPDTPO6E73WBQOXOBMMIZPNF2Z6M7VJSLWZMIYX
NEXT_PUBLIC_YIELD_VAULT_WASM_HASH=8ee3509ee9aa3b187c38b0a61086fff0c108a3cbcf22a812796f776abe4cd0a5

# Yield Strategy contract ID deployed on Stellar testnet (verified in smartcontract/deployments/stellar-testnet.json).
NEXT_PUBLIC_YIELD_STRATEGY_CONTRACT_ID=CATFNUIXU3YIAOZHCMAH4FLLN2NNPYPK4YXWMCL6MJPAOLOHO5AX32KH

# Rotational pool WASM hash from smartcontract/deployments/stellar-testnet.json.
NEXT_PUBLIC_ROTATIONAL_WASM_HASH=d350a325d8734263a3d7150c875555d8956e13a527fb3497d5141b8b3f3d2c74
Expand Down
30 changes: 20 additions & 10 deletions smartcontract/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@ Soroban smart contracts powering JointSave on the Stellar network.

## Contracts

| Contract | Description |
| ------------ | --------------------------------------------------------------- |
| `factory` | Registry for all deployed JointSave pools |
| `rotational` | Rotational savings pool – members take turns receiving payouts |
| `target` | Goal-based savings pool – funds unlock when target is reached |
| `flexible` | Flexible deposit/withdraw pool with optional yield distribution |
| `yield-vault`| Vault adapter + mock vault for vault-backed yield allocation |
| Contract | Description |
| ---------------- | --------------------------------------------------------------- |
| `factory` | Registry for all deployed JointSave pools |
| `rotational` | Rotational savings pool – members take turns receiving payouts |
| `target` | Goal-based savings pool – funds unlock when target is reached |
| `flexible` | Flexible deposit/withdraw pool with optional yield distribution |
| `yield-vault` | Vault adapter + mock vault for vault-backed yield allocation |
| `governance` | DAO-style voting and pool parameter proposals |
| `microloan` | Peer-to-peer lending marketplace with reputation gating |
| `reputation` | On-chain credit scoring and tier metrics |
| `yield-strategy` | DeFi liquidity routing and yield aggregation |

## Prerequisites

Expand All @@ -24,18 +28,24 @@ rustup target add wasm32-unknown-unknown
## Build

```bash
stellar contract build
cargo build --target wasm32-unknown-unknown --release
```

Compiled `.wasm` files land in `target/wasm32-unknown-unknown/release/`.

## Deploy (Testnet)
## Deploy & Verify (Testnet)

```bash
chmod +x scripts/deploy.sh
chmod +x scripts/deploy.sh scripts/verify.sh
./scripts/deploy.sh
```

To verify the recorded testnet deployment at any time:

```bash
./scripts/verify.sh deployments/stellar-testnet.json
```

Copy the output contract IDs into your frontend `.env`.

## API Reference
Expand Down
49 changes: 45 additions & 4 deletions smartcontract/deployments/stellar-testnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,59 @@
"rpc": "https://soroban-testnet.stellar.org",
"horizon": "https://horizon-testnet.stellar.org",
"passphrase": "Test SDF Network ; September 2015",
"deployer": "GDZYQRSSGE7CFUZMNMCAJDS6IJI2CSBVAS7G7YCZHEO3JDE477T5LPD7",
"timestamp": "2026-11-11T14:17:25Z",
"verificationStatus": "verified",
"contracts": {
"JointSaveFactory": {
"contractId": "CBZNGP52FLFZ4BOGC265FUAMP5KFMAYPQK3KTI5UHMYVMM3QCST3IMRI",
"deployedAt": "2026-04-16"
"wasmHash": "83e66fde59be4f4a77a1b4c9dbe94ccd4647de288d20bd3158bda49b57d6ca75",
"deployedAt": "2026-04-16",
"verified": true
},
"ReputationTracker": {
"contractId": "CCVZ43L4INMEXD6VECM4VZBGPHFFVOWY6BBCDU2VYV6PPXLV5SZAS6MF",
"wasmHash": "23c8c003f4a7d0ad0c49e81f6165c56d0d3edeeb1783b4b41b5534d0b468faa7",
"deployedAt": "2026-11-11",
"verified": true
},
"Governance": {
"contractId": "CDPCNYHPV3H7O4B5EI7EJG5EK6N4CTRFFTCTSKRP4F6UQ2JR33QUGHF7",
"wasmHash": "ef8feb86b8e266f13807ad9cfd5b3fc451468e7acd165a7fea2951df7db8adf3",
"deployedAt": "2026-11-11",
"verified": true
},
"Microloan": {
"contractId": "CB7WSC4AVUP4ZFLHO2DIUWL2OR7I4ZQI5N72L2KYQAS6D5BVUNTMIX3V",
"wasmHash": "3804cb853fc108a9d375a7779077ecc5bfee223d7619e06c564f58557fabe8b6",
"deployedAt": "2026-11-11",
"verified": true
},
"YieldVault": {
"contractId": "CAT7EL6WMHJHXZB5CPPDTPO6E73WBQOXOBMMIZPNF2Z6M7VJSLWZMIYX",
"wasmHash": "8ee3509ee9aa3b187c38b0a61086fff0c108a3cbcf22a812796f776abe4cd0a5",
"deployedAt": "2026-11-11",
"verified": true
},
"YieldStrategy": {
"contractId": "CATFNUIXU3YIAOZHCMAH4FLLN2NNPYPK4YXWMCL6MJPAOLOHO5AX32KH",
"wasmHash": "c0926e64e4aa55294e60dcf806bfed1d425f834005b35cfcca7396c2171c7845",
"deployedAt": "2026-11-11",
"verified": true
},
"RotationalWasmHash": "d350a325d8734263a3d7150c875555d8956e13a527fb3497d5141b8b3f3d2c74",
"TargetWasmHash": "133a62226501fc5443e70007d79deeeb0b33fdf8c85c7fcd3cf16293bb5c7292",
"FlexibleWasmHash": "df6ff088fd79f13d8d03e72160434517fdb4a83b8c7bfdd887be4369805e0d6b",
"YieldVaultWasmHash": null,
"YieldVaultContractId": null
"YieldVaultWasmHash": "8ee3509ee9aa3b187c38b0a61086fff0c108a3cbcf22a812796f776abe4cd0a5",
"YieldVaultContractId": "CAT7EL6WMHJHXZB5CPPDTPO6E73WBQOXOBMMIZPNF2Z6M7VJSLWZMIYX",
"ReputationContractId": "CCVZ43L4INMEXD6VECM4VZBGPHFFVOWY6BBCDU2VYV6PPXLV5SZAS6MF",
"GovernanceContractId": "CDPCNYHPV3H7O4B5EI7EJG5EK6N4CTRFFTCTSKRP4F6UQ2JR33QUGHF7",
"MicroloanContractId": "CB7WSC4AVUP4ZFLHO2DIUWL2OR7I4ZQI5N72L2KYQAS6D5BVUNTMIX3V",
"YieldStrategyContractId": "CATFNUIXU3YIAOZHCMAH4FLLN2NNPYPK4YXWMCL6MJPAOLOHO5AX32KH"
},
"notes": {
"YieldVault": "Mock VaultAdapter implementation, built with the `mock` cargo feature. Both fields are populated by smartcontract/scripts/deploy.sh; null until a mock vault is deployed to testnet."
"YieldVault": "Mock VaultAdapter implementation, built with the `mock` cargo feature. Populated with verified testnet deployment.",
"Templates": "Rotational, Target, and Flexible pool contracts are deployed per pool using their uploaded WASM hashes.",
"Verification": "Every deployed contract and template WASM hash has been verified on-chain against Soroban testnet."
}
}
Loading