Thanks to visit codestin.com
Credit goes to github.com

Skip to content

LingSiewWin/TFT-Token2049

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TFT - TON Payment Platform

A cross-chain payment system built on TON blockchain, integrating Telegram Mini Apps with smart contracts for merchant payments and token swaps.

Overview

This platform enables seamless cryptocurrency payments through Telegram, featuring QR-based merchant discovery and cross-chain token swaps from TON to xSGD.

System Architecture

┌──────────────────┐
│  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

Core Components

Smart Contracts (Tact)

  • 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

Backend Services

  • Telegram bot with Grammy.js
  • Express API for transaction coordination
  • Integration with STON.fi, deBridge, and 1inch

Frontend

  • React-based Telegram Mini App
  • TonConnect wallet integration
  • QR code scanner for merchant discovery

Quick Start

Installation

yarn install

Configuration

Create .env.local from the template:

cp .env.example .env.local

Fill in your credentials (see .env.example for required variables).

Deploy Contracts

npx blueprint build
npx blueprint run deployMerchantRegistry
npx blueprint run deployPaymentProcessor

Update .env.local with the deployed contract addresses.

Run Services

# Start bot backend
yarn bot:dev

# Start dApp (in new terminal)
cd src/dapp && yarn dev

How It Works

Payment Flow:

  1. User scans merchant QR code or initiates payment
  2. Smart contract looks up merchant's TON wallet
  3. Payment is processed through PaymentProcessor
  4. Platform fee is deducted, merchant receives payment

Cross-Chain Swap Flow:

  1. User deposits TON to the system
  2. TON → USDT swap via STON.fi (on TON)
  3. USDT bridged from TON → Polygon via deBridge
  4. USDT → xSGD swap via 1inch (on Polygon)
  5. xSGD delivered to user's EVM wallet

Tech Stack

  • 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

Available Commands

# 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

Telegram Bot Features

  • /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

Security

  • Never commit .env.local - it contains sensitive credentials
  • All private keys should be stored in environment variables
  • Use .env.example as a template for required configuration

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published