defiQUG c94eb595f8
Some checks failed
CI / lint-and-test (push) Has been cancelled
Initial commit: add .gitignore and README
2026-02-09 21:51:53 -08:00

Solace Bank Group Treasury Management DApp

A comprehensive Treasury Management DApp with Smart Wallet capabilities, multisig support, sub-accounts, and advanced 3D UI.

Architecture

  • Frontend: Next.js 14+ with TypeScript, Tailwind CSS, GSAP, and Three.js
  • Smart Contracts: Solidity contracts using Hardhat
  • Backend: TypeScript with Drizzle ORM and PostgreSQL
  • Blockchain: Chain 138 (Custom Besu Network), Ethereum (mainnet and Sepolia testnet)

Project Structure

solace-bg-dubai/
├── contracts/          # Smart contracts
├── frontend/           # Next.js application
├── backend/            # Backend API and indexer
└── shared/             # Shared types and utilities

Getting Started

Prerequisites

  • Node.js >= 18
  • PostgreSQL database
  • Ethereum RPC endpoint (Alchemy/Infura)

Installation

  1. Install pnpm (if not already installed):
npm install -g pnpm
  1. Install dependencies:
pnpm install
  1. Set up environment variables:
  • Copy .env.example files in each workspace
  • Configure database, RPC URLs, and contract addresses
  1. Set up database:
cd backend
pnpm run db:generate
pnpm run db:migrate
  1. Deploy contracts:
cd contracts
pnpm run compile
pnpm run deploy:sepolia  # or deploy:local
pnpm run deploy:chain138  # Deploy to Chain 138
  1. Start development servers:
# Root directory
pnpm run dev

# Or individually:
cd frontend && pnpm run dev
cd backend && pnpm run dev
cd backend && pnpm run indexer:start

Features

Smart Wallet

  • Multisig support (N-of-M threshold)
  • Owner management
  • Transaction proposals and approvals
  • ERC-20 and native token transfers

Sub-Accounts

  • Create sub-wallets under main treasury
  • Deterministic address generation
  • Inherited signer configuration

Banking Functions

  • Receive deposits (with QR code)
  • Send payments
  • Internal transfers between accounts
  • Approval management

UI/UX

  • 3D visualizations with Three.js
  • Smooth animations with GSAP
  • Parallax effects
  • Responsive design

Development

Smart Contracts

cd contracts
pnpm run compile      # Compile contracts
pnpm run test         # Run tests
pnpm run coverage     # Generate coverage report

Frontend

cd frontend
pnpm run dev          # Start dev server
pnpm run build        # Build for production
pnpm run lint         # Run linter

Backend

cd backend
pnpm run dev          # Start API server
pnpm run indexer:start # Start event indexer
pnpm run db:migrate   # Run database migrations

Environment Variables

Frontend

  • NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID - WalletConnect project ID
  • NEXT_PUBLIC_SEPOLIA_RPC_URL - Sepolia RPC endpoint
  • NEXT_PUBLIC_TREASURY_WALLET_ADDRESS - Deployed treasury wallet address
  • NEXT_PUBLIC_SUB_ACCOUNT_FACTORY_ADDRESS - Deployed factory address

Backend

  • DATABASE_URL - PostgreSQL connection string
  • RPC_URL - Ethereum RPC endpoint
  • CHAIN_ID - Chain ID (1 for mainnet, 11155111 for Sepolia)
  • CONTRACT_ADDRESS - Treasury wallet contract address

Contracts

  • SEPOLIA_RPC_URL - Sepolia RPC endpoint
  • MAINNET_RPC_URL - Mainnet RPC endpoint
  • CHAIN138_RPC_URL - Chain 138 RPC endpoint (default: http://192.168.11.250:8545)
  • PRIVATE_KEY - Deployer private key
  • ETHERSCAN_API_KEY - Etherscan API key for verification

Chain 138 Deployment

This DApp is configured to work with Chain 138, a custom Besu blockchain network.

Quick Setup

  1. Configure Chain 138:
./scripts/setup-chain138.sh
  1. Deploy contracts to Chain 138:
cd contracts
pnpm run deploy:chain138
  1. Update environment files with deployed contract addresses

Chain 138 Configuration

Proxmox VE Deployment

The DApp can be deployed on Proxmox VE using LXC containers.

Prerequisites

  • Proxmox VE host with LXC support
  • Ubuntu 22.04 LTS template available
  • Network access to Chain 138 RPC nodes (192.168.11.250-252)

Deployment Steps

  1. Configure deployment settings:
cd deployment/proxmox
# Edit config/dapp.conf with your Proxmox settings
  1. Deploy all components:
sudo ./deploy-dapp.sh
  1. Deploy individual components:
sudo ./deploy-database.sh    # PostgreSQL database
sudo ./deploy-backend.sh     # Backend API
sudo ./deploy-indexer.sh     # Event indexer
sudo ./deploy-frontend.sh    # Frontend application

Container Specifications

Component VMID IP Address Resources
Frontend 3000 192.168.11.60 2GB RAM, 2 CPU, 20GB disk
Backend 3001 192.168.11.61 2GB RAM, 2 CPU, 20GB disk
Database 3002 192.168.11.62 4GB RAM, 2 CPU, 50GB disk
Indexer 3003 192.168.11.63 2GB RAM, 2 CPU, 30GB disk

Post-Deployment

  1. Deploy contracts to Chain 138 (if not already done)
  2. Copy environment files to containers:
pct push 3000 frontend/.env.production /opt/solace-frontend/.env.production
pct push 3001 backend/.env /opt/solace-backend/.env
pct push 3003 backend/.env.indexer /opt/solace-indexer/.env.indexer
  1. Run database migrations:
pct exec 3001 -- bash -c 'cd /opt/solace-backend && pnpm run db:migrate'
  1. Start services:
pct exec 3001 -- systemctl start solace-backend
pct exec 3003 -- systemctl start solace-indexer
pct exec 3000 -- systemctl start solace-frontend
  1. Check service status:
pct exec 3000 -- systemctl status solace-frontend
pct exec 3001 -- systemctl status solace-backend
pct exec 3003 -- systemctl status solace-indexer

Nginx Reverse Proxy

For public access, set up Nginx as a reverse proxy. A template configuration is available at:

  • deployment/proxmox/templates/nginx.conf

Documentation

For detailed deployment instructions, see:

  • deployment/proxmox/README.md (if created)
  • scripts/setup-chain138.sh - Chain 138 configuration helper

License

Private - Solace Bank Group PLC (Dubai)

Description
No description provided
Readme 281 KiB
Languages
TypeScript 71.4%
Shell 27.7%
CSS 0.6%
JavaScript 0.3%