Skip to content

atahabilder1/DeSwift

Repository files navigation

DeSwift

Decentralized Interbank Lending Protocol on Solana

License: MIT Solana Rust React

A trustless, collateralized lending protocol enabling instant settlement and transparent algorithmic interest rates for financial institutions.


Quick Start

Prerequisites

Ensure you have these installed:

# Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustc --version  # Should be 1.75+

# Solana CLI
sh -c "$(curl -sSfL https://release.solana.com/stable/install)"
solana --version  # Should be 1.17+

# Anchor
cargo install --git https://github.com/coral-xyz/anchor avm --locked
avm install latest && avm use latest
anchor --version  # Should be 0.29+

# Node.js (for frontend)
node --version  # Should be 18+

# PostgreSQL & Redis
psql --version  # Should be 15+
redis-server --version  # Should be 7+

Setup

# 1. Clone and enter directory
git clone https://github.com/yourusername/DeSwift.git
cd DeSwift

# 2. Build smart contract
cd contracts
anchor build
cd ..

# 3. Setup backend
cd backend
cp .env.example .env
# Edit .env with your database credentials
cargo build
cd ..

# 4. Setup frontend
cd frontend
npm install
cd ..

# 5. Setup database
createdb deswift
psql deswift < migrations/001_initial.sql
psql deswift < migrations/002_add_indexes.sql

Run

Option 1: All-in-one script

./scripts/run-local.sh

Option 2: Manual (3 terminals)

# Terminal 1: Solana validator
solana-test-validator

# Terminal 2: Deploy contract & run backend
cd contracts && anchor deploy
cd ../backend && cargo run

# Terminal 3: Frontend
cd frontend && npm run dev

Open http://localhost:5173


Project Structure

DeSwift/
├── contracts/          # Solana smart contract (Anchor/Rust)
│   └── programs/deswift/src/
├── backend/            # REST API server (Axum/Rust)
│   └── src/
├── frontend/           # Web application (React/TypeScript)
│   └── src/
├── shared/             # Shared Rust types
├── migrations/         # PostgreSQL schemas
├── docs/               # Documentation
└── scripts/            # Utility scripts

Features

Feature Description
Bank Tiers Three-tier credit system with different borrowing limits
Collateral Multi-asset support with risk-adjusted haircuts
Dynamic Rates SOFR-inspired utilization-based interest rates
Loan Terms Overnight, 7-day, and 30-day options
Liquidations Automated engine for underwater positions

Documentation

Read the full documentation - Comprehensive guide covering:

  • Architecture & data flow
  • Smart contract reference (accounts, instructions)
  • Backend API endpoints
  • Frontend components
  • Finance concepts (SOFR, haircuts, liquidations)
  • Deployment guide
  • Testing strategy

Technology Stack

Layer Technology
Blockchain Solana
Smart Contract Anchor (Rust)
Backend Axum (Rust)
Database PostgreSQL
Cache Redis
Frontend React + TypeScript
Styling Tailwind CSS

API Endpoints

Endpoint Description
GET /api/v1/protocol/stats Protocol statistics
GET /api/v1/rates Current interest rates
GET /api/v1/banks List all banks
GET /api/v1/loans List all loans

See full API documentation for details.


Contributing

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/name)
  3. Commit changes
  4. Push and open Pull Request

License

MIT License - see LICENSE for details.


Author

Anik Tahabilder PhD Student, Computer Science Wayne State University tahabilderanik@gmail.com

About

A decentralized interbank lending protocol built on Solana that reimagines SWIFT and Fed Funds markets using smart contracts. Features tiered credit systems, collateralized repo-style loans, SOFR-inspired algorithmic interest rates, and real-time settlement. Full-stack implementation with Rust smart contracts, Axum backend, and React frontend.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors