A decentralized application that enables users in India to pay merchants in INR via UPI, while merchants instantly receive USDT stablecoins in their wallet.
StablePay2.0/
├── frontend/ # React + Vite frontend (Deploy to Vercel)
├── backend/ # Node.js + Express backend (Deploy to Render)
├── contarcts/ # Smart contracts (Deploy to Sepolia)
└── DEPLOYMENT.md # Deployment guide
Want to deploy to production?
👉 QUICK-DEPLOYMENT-STEPS.md - Deploy in ~1 hour!
Need more info?
- Seamless UPI to USDT Bridge: Users pay in INR, merchants receive USDT
- MetaMask Integration: Connect wallet and execute transactions on Sepolia testnet
- KYC Verification: Phone verification and document upload for compliance
- Smart Contract Integration: Uses FiatUSDTSwap contract for secure swaps
- Real-time Conversion: Live INR to USDT rates with GST calculation
- Transaction History: View all swap transactions and balances
- Responsive Design: Works on desktop and mobile devices
Frontend:
- React + Vite
- TypeScript
- Tailwind CSS
- ethers.js v6
- React Router DOM
Backend:
- Node.js + Express
- Supabase (Database & Storage)
- Real-time subscriptions
Blockchain:
- Ethereum Sepolia Testnet
- Custom FiatUSDTSwap Smart Contract
- ERC20 USDT Token
Before running the application, you need:
- MetaMask Extension installed in your browser
- Sepolia ETH for gas fees (get from Sepolia Faucet)
- Contract Addresses - Deploy contracts first (see
contarcts/folder)
cd frontend
npm install
npm run devSee frontend/README.md for details.
cd backend
npm install
npm run devSee backend/README.md for details.
cd contarcts
npm install
npx hardhat run scripts/deploy.js --network sepoliaSee contarcts/README.md for details.
-
Deploy Backend to Render
- See backend/RENDER-DEPLOYMENT.md
- Get your backend URL (e.g.,
https://stablepay-backend.onrender.com)
-
Deploy Frontend to Vercel
- See frontend/README.md
- Set
VITE_API_URLto your backend URL
-
Update Backend CORS
- Add frontend Vercel URL to
ALLOWED_ORIGINS - Restart backend service
- Add frontend Vercel URL to
For complete deployment instructions, see DEPLOYMENT.md.
- Frontend: frontend/README.md - Frontend setup and Vercel deployment
- Backend: backend/RENDER-DEPLOYMENT.md - Backend setup and Render deployment
- Contracts: contarcts/README.md - Smart contract deployment
- Deployment: DEPLOYMENT.md - Complete deployment guide
-
Clone and Install
git clone <repository-url> cd StablePay2.0 npm install
-
Configure Environment
- Click "Connect to Supabase" in the top right of the application
- This will set up your database tables automatically
-
Update Contract Addresses
- Deploy your FiatUSDTSwap contract to Sepolia
- Update the contract addresses in
src/utils/blockchain.ts
-
Start Development Server
npm run dev
- Connect Wallet: Click "Connect Wallet" and approve MetaMask connection
- Verify Phone: Complete phone verification (uses demo OTP system)
- Enter Amount: Input INR amount to convert to USDT
- KYC Check: For amounts >$200, complete KYC verification
- Execute Swap: Confirm transaction in MetaMask (ensure you're on Sepolia)
- Connect Wallet: Connect your MetaMask wallet
- View Dashboard: See your USDT balance and transaction history
- Monitor Transactions: Real-time updates of incoming swaps
The application integrates with these key contract functions:
calculateSwap(): Get conversion rates and GST amountsswapUSDTToFiat(): Execute USDT to fiat currency swapsgetUserSwapHistory(): Retrieve user's transaction historygetRecentSwaps(): Get recent platform transactions
The app automatically switches to Sepolia testnet. Network details:
- Chain ID: 11155111 (0xaa36a7)
- RPC URL: Sepolia Infura endpoint
- Block Explorer: https://sepolia.etherscan.io
- User enters INR amount
- Smart contract calculates USDT equivalent + GST
- User approves USDT spending (if needed)
- Contract executes swap and records transaction
- Event emitted and UI updated with transaction hash
- KYC Compliance: Phone verification and document upload
- Transaction Limits: $200 threshold for enhanced verification
- Smart Contract Security: Uses OpenZeppelin's SafeERC20
- Network Validation: Ensures transactions on correct network
The app uses Supabase with these main tables:
users: User profiles and KYC statustransactions: Transaction records with amounts and statuskyc_documents: Uploaded verification documentsotp_storage: Phone verification codes
The application is deployed and accessible at: [Your Deployment URL]
To deploy your own instance:
- Deploy smart contracts to Sepolia
- Update contract addresses in the code
- Configure Supabase project
- Deploy frontend to your preferred hosting platform
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly on Sepolia testnet
- Submit a pull request
This project is licensed under the MIT License.
This is a demo application for educational purposes. Do not use with real funds on mainnet without proper security audits and regulatory compliance.