Skip to content

joshuagit706/SoroFi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SoroFi

A full-stack DeFi platform built on Stellar and Soroban — Stellar's smart contract platform.

SoroFi lets users mint tokens, participate in DAO governance, stream payments, interact with AMM pools, and more — all from a single platform with a Next.js frontend, Node.js backend, and a suite of Rust/Soroban smart contracts.


Project Structure

sorofi/
├── frontend/        # Next.js 14 app (App Router)
├── backend/         # Node.js / Express API
└── contracts/       # Rust / Soroban smart contracts

Frontend

Built with Next.js 14 (App Router), Tailwind CSS, and Zustand for state management.

Pages

Route Description
/ Dashboard — mint tokens and view your assets
/governance DAO governance — create and vote on proposals
/developer-hub API and contract documentation

Key dependencies

  • @stellar/freighter-api — Freighter wallet integration
  • react-i18next — i18n (English + Arabic)
  • zustand — client state management
  • react-toastify — notifications
  • lucide-react — icons

Setup

cd frontend
npm install
cp .env.example .env.local
npm run dev

Environment variables

NEXT_PUBLIC_API_BASE_URL=http://localhost:5000/api
NEXT_PUBLIC_STELLAR_NETWORK=TESTNET
NEXT_PUBLIC_NETWORK_PASSPHRASE=Test SDF Network ; September 2015

Backend

Built with Node.js / Express, using Knex for database access (SQLite in dev, PostgreSQL in prod), Redis for caching, and Socket.io for real-time events.

Key features

  • SEP-10 challenge-response authentication via Freighter
  • Token minting and asset management
  • Off-chain governance (Snapshot-style token-weighted voting)
  • Payment streaming
  • Webhook delivery
  • Billing via Stripe
  • Event indexing from Soroban contract events
  • Rate limiting, fraud detection, and audit logging

Setup

cd backend
npm install
cp .env.example .env
# Edit .env with your credentials
npm run dev

Key environment variables

Variable Description
SOROBAN_RPC_URL Soroban RPC endpoint (Testnet/Futurenet)
NETWORK_PASSPHRASE Stellar network passphrase
DATABASE_URL PostgreSQL connection string (prod)
REDIS_URL Redis connection string
JWT_SECRET Secret for signing JWTs
STRIPE_SECRET_KEY Stripe API key for billing

See backend/.env.example for the full list.

API overview

Prefix Description
POST /api/auth/challenge SEP-10 challenge
POST /api/auth/login Exchange signed XDR for JWT
GET /api/tokens/:address List tokens for a wallet
POST /api/tokens Mint a new token
GET /api/proposals List governance proposals
POST /api/proposals Create a proposal
POST /api/proposals/:id/votes Cast a vote
GET /api/voting-power Get your voting power

Full API docs are available at /api/docs (Swagger UI) when the backend is running.


Smart Contracts

Written in Rust targeting the Soroban runtime. The workspace lives in contracts/.

Available contracts

Contract Description
token SEP-41 token with minting limits and transferability controls
factory Deploys and tracks token contracts
amm_pool Automated market maker liquidity pool
amm_factory Deploys AMM pools
lending_pool Collateralised lending and borrowing
vault Asset vault with access controls
streaming Real-time payment streaming
dividend On-chain dividend distribution
multisig Multi-signature transaction approval
access DAO role-based access control
compliance KYC/AML compliance hooks
vesting Token vesting schedules
timelock Time-locked execution
flash_loan Flash loan provider
merkle_whitelist Merkle-proof whitelist
oracle Price oracle integration
otc_escrow OTC trade escrow
lottery On-chain lottery
zk_audit_log Zero-knowledge audit log

Prerequisites

rustup target add wasm32-unknown-unknown

Build

cd contracts
cargo build --release --target wasm32-unknown-unknown

Test

cd contracts
cargo test

Authentication flow

SoroFi uses SEP-10 for wallet-based authentication:

  1. Frontend requests a challenge transaction from the backend
  2. User signs the transaction with their Freighter wallet
  3. Signed XDR is submitted to the backend
  4. Backend verifies the signature and returns a JWT
  5. JWT is used for all subsequent authenticated requests

Development

Run all three layers locally:

# Terminal 1 — backend
cd backend && npm run dev

# Terminal 2 — frontend
cd frontend && npm run dev

# Terminal 3 — contracts (optional, for testing)
cd contracts && cargo test

Frontend runs on http://localhost:3000, backend on http://localhost:5000.


License

MIT

About

DeFi platform on Stellar/Soroban. Mint tokens, stream payments, trade on AMM pools, and govern with on-chain voting — all secured by SEP-10 wallet auth.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages