A cross-chain payment system built on TON blockchain, integrating Telegram Mini Apps with smart contracts for merchant payments and token swaps.
This platform enables seamless cryptocurrency payments through Telegram, featuring QR-based merchant discovery and cross-chain token swaps from TON to xSGD.
┌──────────────────┐
│ Telegram Bot │ User interface via Telegram
└────────┬─────────┘
│
▼
┌──────────────────┐
│ React dApp │ QR scanner, wallet connection
└────────┬─────────┘
│
▼
┌──────────────────┐
│ Smart Contracts │ On-chain logic (TON)
│ ----------------│
│ • Merchant Reg │
│ • Payment Proc │
│ • Ramp Tracker │
│ • Escrow │
└────────┬─────────┘
│
▼
┌──────────────────┐
│ Token Bridge │ STON.fi → deBridge → 1inch
└──────────────────┘ TON → Polygon → xSGD
- MerchantRegistry - Maps QR codes to TON wallet addresses
- PaymentProcessor - Handles payments with platform fees
- RampTransactionTracker - Tracks cross-chain transactions
- RampEscrow - Manages escrow for token swaps
- Telegram bot with Grammy.js
- Express API for transaction coordination
- Integration with STON.fi, deBridge, and 1inch
- React-based Telegram Mini App
- TonConnect wallet integration
- QR code scanner for merchant discovery
yarn installCreate .env.local from the template:
cp .env.example .env.localFill in your credentials (see .env.example for required variables).
npx blueprint build
npx blueprint run deployMerchantRegistry
npx blueprint run deployPaymentProcessorUpdate .env.local with the deployed contract addresses.
# Start bot backend
yarn bot:dev
# Start dApp (in new terminal)
cd src/dapp && yarn devPayment Flow:
- User scans merchant QR code or initiates payment
- Smart contract looks up merchant's TON wallet
- Payment is processed through PaymentProcessor
- Platform fee is deducted, merchant receives payment
Cross-Chain Swap Flow:
- User deposits TON to the system
- TON → USDT swap via STON.fi (on TON)
- USDT bridged from TON → Polygon via deBridge
- USDT → xSGD swap via 1inch (on Polygon)
- xSGD delivered to user's EVM wallet
- Blockchain: TON (Tact smart contracts)
- Backend: Node.js, TypeScript, Grammy.js, Express
- Frontend: React, TonConnect SDK, Vite
- Tools: Blueprint (TON development), @ton/sandbox (testing)
- APIs: STON.fi, deBridge, 1inch
# Development
yarn bot:dev # Start Telegram bot
yarn dapp:dev # Start React dApp
# Smart Contracts
npx blueprint build # Compile contracts
npx blueprint run # Deploy contracts
yarn test # Run contract tests/start- Initialize bot and open Mini App/scan- Launch QR code scanner/lookup <qr>- Find merchant wallet by QR code/ramp <amount> <address>- Initiate cross-chain swap/wallet- View bot wallet details/stats- Platform statistics
- Never commit
.env.local- it contains sensitive credentials - All private keys should be stored in environment variables
- Use
.env.exampleas a template for required configuration
MIT