ETH-FLOW BridgeOf PyUSD is a decentralized bridge protocol that enables seamless conversion from blockchain stablecoins (USDC/USDT/PyUSD) to Indian Rupees (INR) using UPI (Unified Payments Interface). The protocol employs a Dutch auction mechanism to facilitate fair pricing and automated settlement through a network of authorized resolvers.
- ๐ฆ Blockchain to UPI Bridge: Convert crypto stablecoins directly to INR via UPI payments
- โ๏ธ Dutch Auction Pricing: Fair market-driven price discovery mechanism
- ๐ค Automated Settlement: Resolver bots handle payments automatically using RazorpayX
- ๐ฑ Mobile-First UI: PWA-enabled interface with QR code scanning
- ๐ Trustless Architecture: Smart contract-based escrow and settlement
- ๐ธ Low Fees: Competitive resolver fees with transparent pricing
- ๐ Multi-Network: Deployed on Arbitrum Sepolia and Flow EVM Testnet
Goal of the Track: Build a consumer-oriented app on Flow that demonstrates mass adoption potential, usability, and a seamless user experience.
Integration in this project:
Flow EVM Testnet Deployment: The README explicitly mentions that the smart contracts are deployed on Flow EVM Testnet (OrderProtocol.sol). This satisfies the requirement of running transactions on Flow.
Consumer-Facing UX:
- Frontend is PWA-enabled with QR scanning for UPI payments.
- Makers can easily create orders, monitor Dutch auctions in real-time, and receive INR in their accounts.
- The mobile-first interface makes the experience seamless and intuitive, targeting mass adoption.
Practical Use Case: By enabling conversion of USDC/PyUSD โ INR via UPI, the project directly addresses a real-world payment problem for consumers in India. This aligns with the "killer app" criteria of providing significant utility to everyday users.
Summary: The Flow track is integrated via smart contract deployment on Flow, combined with a mobile-first frontend that allows consumers to use PYUSD/USDC to get INR instantly. The project demonstrates real-world, user-friendly payment solutions leveraging Flow's blockchain capabilities.
Goal of the Track: Demonstrate a working project using CPU-only VMs from Fluence for AI applications or backend services that are efficient and deployable without GPUs.
Integration in this project:
Backend and Resolver Bot Deployment: The project is designed with a Node.js backend (backend/) and a resolver bot (resolver-bot/) that can run in lightweight server environments. Both components can easily run on CPU-only VMs, which aligns with the Fluence requirement.
- Backend handles API requests, Dutch auction logic, and database operations.
- Resolver bot monitors auctions and interacts with RazorpayX to process UPI payments.
Dockerization: The project provides a docker-compose.yml for containerized deployment of frontend, backend, and resolver bot. This ensures easy setup on Fluence virtual servers without GPU dependencies.
Automated Settlement Logic: The resolver bot implements automated payment processing, making this project a CPU-efficient real-time service. It can run inference or monitoring tasks for auction orders efficiently on small VMs, demonstrating "impactful use" of virtual server resources.
Summary: The Fluence prize track is addressed by deploying the backend, resolver bot, and possibly the smart contract interaction scripts on Fluence CPU-only VMs, showing efficient server-side operations and live transaction processing without relying on GPUs.
Goal of the Track: Awarded to the project that demonstrates a powerful and scalable real-world use case for PYUSD, setting a new benchmark in digital payments. It should highlight how PYUSD unlocks unique valueโwhether via remittances, commerce, or new economic opportunities.
Integration in this project:
Blockchain-to-UPI Payments at Scale: Our project enables direct conversion of PYUSD into Indian Rupees (INR) through UPI, India's most widely used payment system. This bridges the gap between blockchain payments and traditional finance, allowing real-world spending of PYUSD without intermediaries.
- Dutch Auction Mechanism: Ensures fair, market-driven exchange rates for converting PYUSD โ INR.
- Trustless Settlement: Smart contracts hold PYUSD in escrow, ensuring transparent and secure execution.
- Global Accessibility: Anyone holding PYUSD can now pay or remit funds into India seamlessly, unlocking cross-border commerce and remittance flows.
Automated Resolver Network: A network of resolvers competes to settle payments using RazorpayX. This model ensures scalability, fair pricing, and faster settlementsโshowcasing how PYUSD can power decentralized payment infrastructure.
Summary: The project demonstrates a transformative, real-world use case for PYUSD by connecting it to one of the largest real-time retail payment systems (UPI). This sets a new benchmark for digital stablecoin utility in developing markets.
Goal of the Track: Recognize the project that builds the most seamless and engaging consumer payment experience with PYUSD, especially for real-world microtransactions, cross-border settlements, or programmable subscriptions.
Integration in this project:
Seamless User Flow for Consumers:
- Mobile-first PWA: The frontend is designed as a Progressive Web App (PWA) so users can access it from mobile devices without installing an app.
- QR Code Payments: Makers simply scan or upload UPI QR codes, reducing friction in onboarding and payment flows.
- Instant INR Credit: Consumers receive INR directly into their UPI-linked bank account, making PYUSD practically usable for daily payments.
Real-time Updates & UX:
- Socket.IO integration gives consumers real-time auction updates, improving transparency and trust.
- Clear Pricing with Auctions: The Dutch auction format ensures users always get a fair and transparent exchange rate, enhancing confidence in using PYUSD for payments.
Summary: By creating a consumer-first payment journeyโfrom wallet connection to INR settlementโthe project shows how PYUSD can become mainstream in everyday transactions in India, a market with 300M+ UPI users.
Goal of the Track: Celebrate projects that think outside the wallet and apply PYUSD in unexpected but impactful waysโwhether in gaming, education, social, or financial apps.
Integration in this project:
Novel Dutch Auction Settlement for Stablecoin โ Fiat Conversion: Instead of fixed rates or centralized exchanges, we designed a Dutch auction engine for pricing PYUSD conversions. This mechanism is rarely applied in stablecoin-to-fiat transfers and ensures decentralized, transparent price discovery.
Decentralized Resolver Network: The project introduces the idea of resolver botsโindependent entities that compete to process UPI payments using PYUSD escrow. This creates a new market-driven ecosystem of payment processors, incentivized through resolver fees.
Cross-Network & Composability:
- Deployed on Arbitrum Sepolia and Flow EVM Testnet.
- Open-source smart contracts allow developers to extend and build new payment modules on top of our system (e.g., subscriptions, payroll, or remittance services).
Summary: The project's auction-based settlement + decentralized resolver model is a completely new way of using PYUSD in payments. It highlights an innovative design space for programmable moneyโunlocking potential beyond simple transfers.
graph TB
subgraph "๐ Frontend Layer"
A[Next.js Web Interface<br/>PWA + TypeScript]
B[QR Code Scanner<br/>UPI Detection]
C[Order Dashboard<br/>Real-time Updates]
D[Wallet Integration<br/>RainbowKit + Wagmi]
A --> B
B --> C
A --> D
end
subgraph "โก Backend Layer"
E[Express.js API Server<br/>REST + WebSocket]
F[Socket.IO Server<br/>Real-time Events]
G[Dutch Auction Engine<br/>Price Discovery]
H[MongoDB Database<br/>Order Management]
E --> F
F --> G
E --> H
end
subgraph "โ๏ธ Blockchain Layer"
I[OrderProtocol Contract<br/>Main Logic + Escrow]
J[MakerRegistry<br/>User Management]
K[ResolverRegistry<br/>Staking + Authorization]
L[PyUSD/USDC Token<br/>ERC-20 Stablecoins]
I --> J
I --> K
I --> L
end
subgraph "๐ณ Payment Layer"
M[Resolver Bot<br/>24/7 Automated Service]
N[RazorpayX API<br/>Payment Processing]
O[UPI Gateway<br/>Indian Payment System]
P[Bank Account<br/>INR Settlement]
M --> N
N --> O
O --> P
end
%% Connections between layers
A -.->|API Calls| E
E -.->|Contract Calls| I
M -.->|Event Listening| I
M -.->|Socket Connection| F
F -.->|Price Updates| A
%% Styling
classDef frontend fill:#e3f2fd,stroke:#1976d2,stroke-width:2px
classDef backend fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px
classDef blockchain fill:#e8f5e8,stroke:#388e3c,stroke-width:2px
classDef payment fill:#fff3e0,stroke:#f57c00,stroke-width:2px
class A,B,C,D frontend
class E,F,G,H backend
class I,J,K,L blockchain
class M,N,O,P payment
sequenceDiagram
participant Maker as ๐ค Maker<br/>(User)
participant Frontend as ๐ Frontend<br/>(Next.js)
participant Backend as โก Backend<br/>(Express)
participant Contract as โ๏ธ Smart Contract<br/>(OrderProtocol)
participant Token as ๐ฐ Token Contract<br/>(USDC/PyUSD)
participant Bot as ๐ค Resolver Bot<br/>(Automated)
participant RazorPay as ๐ณ RazorpayX<br/>(Payment API)
participant UPI as ๐ฆ UPI<br/>(Bank Account)
Note over Maker,UPI: Phase 1: Order Creation
Maker->>Frontend: 1. Scan UPI QR Code
Frontend->>Maker: 2. Extract payment details
Maker->>Frontend: 3. Set price range (start/end)
Frontend->>Contract: 4. Call createOrder()
Contract->>Token: 5. Lock stablecoins (escrow)
Token-->>Contract: 6. Confirm token lock
Contract-->>Frontend: 7. Emit OrderCreated event
Frontend->>Backend: 8. Notify new order
Backend-->>Frontend: 9. Start Dutch auction
Note over Maker,UPI: Phase 2: Dutch Auction
Backend->>Frontend: 10. Broadcast price updates
Backend->>Bot: 11. Socket.IO price events
Bot->>Bot: 12. Calculate profitability
Note over Maker,UPI: Phase 3: Order Acceptance
Bot->>Backend: 13. Accept order at current price
Backend->>Contract: 14. Call acceptOrder()
Contract-->>Backend: 15. Emit OrderAccepted event
Backend->>Bot: 16. Callback: order accepted
Backend->>Frontend: 17. Notify auction ended
Note over Maker,UPI: Phase 4: Payment Processing
Bot->>RazorPay: 18. Create VPA payout
RazorPay->>UPI: 19. Process UPI payment
UPI-->>RazorPay: 20. Payment confirmation
RazorPay-->>Bot: 21. Return payment proof
Bot->>Backend: 22. Submit proof
Backend->>Contract: 23. Call fulfillOrder()
Note over Maker,UPI: Phase 5: Settlement
Contract->>Token: 24. Release tokens to resolver
Contract-->>Backend: 25. Emit OrderFulfilled event
Backend->>Frontend: 26. Update order status
Frontend-->>Maker: 27. Show completion
Note over Maker,UPI: โ
Transaction Complete
Note over Maker: Maker receives INR in UPI account
Note over Bot: Resolver earns price spread + fees
graph TD
A[Order Created<br/>Start Price: โน85/USDC] --> B[Dutch Auction Begins<br/>Duration: 5-10 seconds]
B --> C{Price Decreases<br/>Non-linearly}
C --> D[Current Price: โน84]
C --> E[Current Price: โน83]
C --> F[Current Price: โน82]
C --> G[End Price: โน82/USDC]
H[Multiple Resolvers<br/>Monitor Auction] --> I{Profitability<br/>Check}
I -->|Profitable| J[Resolver Accepts<br/>at Current Price]
I -->|Wait| K[Continue Monitoring]
K --> I
J --> L[Auction Ends<br/>Winner Selected]
L --> M[Payment Processing<br/>Begins]
D -.-> H
E -.-> H
F -.-> H
G -.-> H
style A fill:#e8f5e8,stroke:#4caf50
style J fill:#fff3e0,stroke:#ff9800
style L fill:#e3f2fd,stroke:#2196f3
style M fill:#f3e5f5,stroke:#9c27b0
- Makers scan UPI QR codes or manually enter payment details
- Smart contract locks stablecoins (USDC/PyUSD) as collateral
- Dutch auction is initiated with start/end price range
- Price decreases from start price to end price over time
- Multiple resolvers compete to accept orders at favorable prices
- First resolver to accept wins the order
- Winning resolver processes UPI payment via RazorpayX
- Payment proof is submitted to the smart contract
- Stablecoins are released to the resolver upon successful payment
- Maker receives INR in their UPI account
- Resolver earns the difference between accepted price and actual payment
- Transaction is completed and recorded on-chain
- Framework: Next.js 15 with TypeScript
- Web3 Integration: Wagmi + RainbowKit
- UI Components: Radix UI + Tailwind CSS
- QR Scanning: @yudiel/react-qr-scanner
- Real-time Updates: Socket.IO Client
- Charts: Chart.js + React Chart.js 2
- PWA Support: next-pwa
- Runtime: Node.js with Express.js
- Database: MongoDB with Mongoose
- Real-time Communication: Socket.IO
- Security: Helmet, CORS, Rate Limiting
- Dutch Auction Engine: Custom implementation
- Framework: Foundry (Solidity ^0.8.20)
- Standards: OpenZeppelin contracts
- Networks: Arbitrum Sepolia, Flow EVM Testnet
- Token Support: USDC, PyUSD, MockUSDC
- Runtime: Node.js with Express
- Blockchain Interaction: ethers.js v6
- Payment Processing: RazorpayX API
- Logging: Winston
- Real-time Events: Socket.IO Client
- Containerization: Docker + Docker Compose
- Testing: Foundry Test Suite
- Deployment: Manual deployment with verification
- Monitoring: Comprehensive logging system
- Node.js 18+ and npm/yarn
- Docker and Docker Compose
- Foundry for smart contract development
- RazorpayX API credentials
- Web3 wallet (MetaMask recommended)
- Clone the repository
git clone https://github.com/yug49/ETH-FLOW-BridgeOf-PyUSD.git
cd ETH-FLOW-BridgeOf-PyUSD- Install dependencies for all components
# Frontend
cd frontend
npm install
cd ..
# Backend
cd backend
npm install
cd ..
# Resolver Bot
cd resolver-bot
npm install
cd ..
# Smart Contracts (if not already installed)
forge install- Environment Configuration
Create .env files in each component directory:
Root .env:
# Blockchain Configuration
RPC_URL=https://sepolia-rollup.arbitrum.io/rpc
PRIVATE_KEY=your_private_key_here
CONTRACT_ADDRESS=0xB39F0F6eD29B4502c199171E2d483fCe05E0f5b2
USDC_CONTRACT_ADDRESS=0x637A1259C6afd7E3AdF63993cA7E58BB438aB1B1
# API Configuration
BACKEND_URL=http://localhost:5001
FRONTEND_URL=http://localhost:3000
# Database
MONGODB_URI=mongodb://localhost:27017/orderprotocol
# RazorpayX Configuration
RAZORPAYX_KEY_ID=your_razorpayx_key_id
RAZORPAYX_KEY_SECRET=your_razorpayx_key_secret
RAZORPAYX_ACCOUNT_NUMBER=your_account_numberFrontend .env.local:
NEXT_PUBLIC_BACKEND_URL=http://localhost:5001
NEXT_PUBLIC_CONTRACT_ADDRESS=0xB39F0F6eD29B4502c199171E2d483fCe05E0f5b2
NEXT_PUBLIC_CHAIN_ID=421614Backend .env:
PORT=5001
MONGODB_URI=mongodb://localhost:27017/orderprotocol
FRONTEND_URL=http://localhost:3000
NODE_ENV=developmentResolver Bot .env:
PRIVATE_KEY=your_resolver_private_key
RPC_URL=https://sepolia-rollup.arbitrum.io/rpc
CONTRACT_ADDRESS=0xB39F0F6eD29B4502c199171E2d483fCe05E0f5b2
BACKEND_URL=http://localhost:5001
RAZORPAYX_KEY_ID=your_razorpayx_key_id
RAZORPAYX_KEY_SECRET=your_razorpayx_key_secret
RAZORPAYX_ACCOUNT_NUMBER=your_account_number
RESOLVER_CALLBACK_PORT=3001
LOG_LEVEL=info# Start all services
docker-compose up -d
# View logs
docker-compose logs -f# Terminal 1: Backend
cd backend
npm run dev
# Terminal 2: Frontend
cd frontend
npm run dev
# Terminal 3: Resolver Bot
cd resolver-bot
npm run dev
# Terminal 4: MongoDB (if running locally)
mongod- Frontend: http://localhost:3000
- Backend API: http://localhost:5001
- API Health Check: http://localhost:5001/health
- Resolver Bot Callback: http://localhost:3001/health
-
Connect Wallet
- Visit the web interface
- Connect your Web3 wallet (MetaMask recommended)
- Ensure you have USDC/PyUSD tokens
-
Create Order
- Scan a UPI QR code or enter payment details manually
- Set your preferred price range (start price > end price)
- Confirm transaction to lock your stablecoins
-
Monitor Auction
- Watch the Dutch auction progress in real-time
- Price decreases over time until a resolver accepts
-
Receive Payment
- Once accepted, resolver processes UPI payment
- You receive INR in your specified UPI account
- Transaction completes automatically
-
Registration
- Stake 10 USDC as collateral in ResolverRegistry
- Get approved by the protocol admin
- Set up resolver bot with RazorpayX credentials
-
Run Resolver Bot
- Configure environment variables
- Start the resolver bot:
npm start - Bot monitors Dutch auctions automatically
-
Earn Fees
- Bot accepts profitable orders automatically
- Processes UPI payments via RazorpayX
- Earns spread between acceptance price and order amount
- Smart Contract Interaction
// Example: Create an order
orderProtocol.createOrder(
1000 * 1e18, // 1000 INR amount
85 * 1e18, // 85 INR per USDC start price
82 * 1e18, // 82 INR per USDC end price
"recipient@upi"
);- API Integration
// Example: Accept an order
const response = await fetch('/api/orders/ORDER_ID/accept', {
method: 'POST',
body: JSON.stringify({
acceptedPrice: '83500000000000000000',
resolverAddress: '0x...'
})
});ETH-FLOW-BridgeOf-PyUSD/
โโโ frontend/ # Next.js frontend application
โ โโโ src/
โ โ โโโ app/ # App router pages
โ โ โโโ components/ # React components
โ โ โโโ lib/ # Utility libraries
โ โโโ package.json
โโโ backend/ # Express.js backend API
โ โโโ routes/ # API route handlers
โ โโโ models/ # Database models
โ โโโ server.js # Main server file
โ โโโ package.json
โโโ resolver-bot/ # Automated resolver bot
โ โโโ index.js # Main bot logic
โ โโโ abi/ # Contract ABIs
โ โโโ package.json
โโโ src/ # Smart contracts
โ โโโ OrderProtocol.sol # Main protocol contract
โ โโโ MakerRegistry.sol # Maker management
โ โโโ ResolverRegistry.sol # Resolver management
โ โโโ interface/ # Contract interfaces
โโโ test/ # Contract tests
โโโ script/ # Deployment scripts
โโโ docker-compose.yml # Docker configuration
โโโ foundry.toml # Foundry configuration
โโโ Deployments.md # Contract addresses
Address: 0xB39F0F6eD29B4502c199171E2d483fCe05E0f5b2 (Arbitrum Sepolia)
Key Functions:
createOrder(): Create a new payment orderacceptOrder(): Accept an order during Dutch auctionfullfillOrder(): Complete order with payment proofgetOrder(): Retrieve order details
Address: 0x40F05c21eE1ab02B1Ddc11D327253CEdeE5D7D55
Purpose: Manages authorized makers and their UPI details
Address: 0xAC49Bd1e5877EAB0529cB9E3beaAAAF3dF67DE9f
Purpose: Manages resolver staking and authorization
# Run all tests
forge test
# Run specific test with verbosity
forge test --match-contract OrderProtocolTest -vv
# Generate coverage report
forge coverage# Backend API tests
cd backend
npm test
# Frontend component tests
cd frontend
npm test
# Resolver bot tests
cd resolver-bot
npm run testContracts are deployed on:
- Arbitrum Sepolia Testnet
- Flow EVM Testnet
# Deploy to Arbitrum Sepolia
forge create --rpc-url $ARB_SEPOLIA_RPC_URL \
--private-key $PRIVATE_KEY \
src/OrderProtocol.sol:OrderProtocol \
--constructor-args $CONSTRUCTOR_ARGS \
--verify
# Deploy to Flow EVM
forge create --rpc-url $FLOW_EVM_RPC_URL \
--private-key $PRIVATE_KEY \
src/OrderProtocol.sol:OrderProtocol \
--constructor-args $CONSTRUCTOR_ARGS- Reentrancy Protection: OpenZeppelin's security patterns
- Access Controls: Role-based permissions
- Input Validation: Comprehensive parameter checking
- Time-based Controls: Order expiration and fulfillment timeouts
- Rate Limiting: Protection against abuse
- CORS Configuration: Restricted origin access
- Input Sanitization: SQL injection prevention
- Authentication: Wallet-based verification
- RazorpayX Integration: Bank-grade security
- Transaction Verification: Proof-based settlement
- Escrow Mechanism: Smart contract holds funds
- Dispute Resolution: Admin intervention capability
- Testnet Only: Currently deployed on testnets only
- Manual Resolver Approval: Requires admin approval for new resolvers
- INR Price Feed: Uses fixed conversion rates (to be replaced with oracles)
- RazorpayX Dependency: Relies on centralized payment processor
- Gas Costs: Transaction fees on Arbitrum network
- Mainnet Deployment: Production deployment on Arbitrum One
- Oracle Integration: Real-time INR/USD price feeds
- Multi-Currency Support: EUR, GBP, and other fiat currencies
- Mobile App: Native iOS/Android applications
- Advanced Analytics: Detailed transaction reporting
- Governance Token: Decentralized protocol governance
- Cross-chain Bridge: Support for Ethereum, Polygon, etc.
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open a Pull Request
This project is licensed under the MIT License. See LICENSE file for details.
Built for hackathons and decentralized finance innovation. Special thanks to:
- Flow blockchain for EVM compatibility
- Arbitrum for scaling solutions
- RazorpayX for payment infrastructure
- OpenZeppelin for security standards
โก Ready to bridge the gap between crypto and traditional payments? Get started today!