
DeWrap
A cross-chain crypto smart payment collector platform with automated token swapping and investment.
Demo
About
**DeWrap** is a Web3-native payment platform designed specifically for builders, creators, agencies, and freelancers who want to accept cryptocurrency payments with maximum flexibility and automation. The platform solves the fundamental problem of crypto payment fragmentation by providing a unified solution for cross-chain, multi-token payments with intelligent automation. ### Core Problem & Solution **Problem**: Traditional crypto payment solutions are limited by: - Single-chain restrictions - Manual token conversion processes - Complex cross-chain payment handling - Lack of automated investment strategies - Fragmented payment tracking across networks **Solution**: DeWrap provides a complete payment infrastructure that: - Accepts payments in ANY ERC-20 token or native tokens across multiple blockchain networks - Automatically converts tokens using 1inch's cross-chain DEX aggregation - Provides intelligent invoicing with flexible payment preferences - Offers automated investment and dollar-cost averaging (DCA) capabilities [COMING SOON] - Maintains comprehensive payment tracking and analytics ### Key Features & Capabilities **1. Multi-Token Payment Acceptance** - Support for any ERC-20 token across all EVM chains that are supported by 1inch Protocol - Native token support (ETH, MATIC, etc.) - Automatic payment validation and processing **2. Cross-Chain Infrastructure** - Powered by 1inch's Fusion Plus cross-chain API - Seamless token bridging and swapping across networks - Real-time quote generation for optimal swap routes - Automated transaction execution with MEV protection **3. Smart Invoicing System** - Create professional invoices with flexible payment options - Set preferred tokens and chains for each invoice - Real-time payment status tracking - Automated payment matching and processing **4. Automated Token Management** [COMING SOON] - Auto-swap functionality to convert received tokens to preferred tokens - Dollar-cost averaging (DCA) for systematic investment - Investment portfolio tracking and analytics - Scheduled swap execution via cron jobs **5. User Management & Analytics** - Secure authentication via Clerk - Comprehensive user profiles with payment preferences - Real-time balance tracking across all supported networks [USING 1INCH API] - Detailed transaction history and analytics [USING 1INCH API] - Performance metrics and insights ### Technical Architecture **Frontend (Next.js 15)** - Modern React 19 with TypeScript - Tailwind CSS 4 for responsive design - Radix UI for accessible components - Wagmi + AppKit for Web3 integration - Real-time data fetching with TanStack Query **Smart Contracts (Solidity 0.8.27)** - `DeWrap.sol`: Core contract managing users, invoices, and payouts - `DewrapPaymentCollector.sol`: Payment collection and processing - `PaymentCollectorFactory.sol`: Factory pattern for scalable deployment - OpenZeppelin contracts for security and best practices **Backend Infrastructure** - PostgreSQL database with Prisma ORM - **1inch Cross-Chain API** integration - Viem for Ethereum interactions - Zod for runtime validation - Comprehensive API endpoints for all operations **Key API Endpoints** - `/api/user` - User management and profiles - `/api/invoice` - Invoice creation and management - `/api/payment` - Payment processing and tracking - `/api/quote` - Real-time token price quotes - `/api/execute` - Cross-chain transaction execution - `/api/supported-network` - Network and token information - `/api/token` - Descriptive detail regarding token ### Target Users & Use Cases **Primary Users**: - **Freelancers**: Accept payments in any token, automatically convert to preferred tokens - **Agencies**: Manage multiple client payments across different networks - **Content Creators**: Monetize with crypto while maintaining payment flexibility - **Web3 Builders**: Integrate DeWrap for project funding and revenue collection **Use Cases**: - Invoice-based payment collection with automatic token conversion - Cross-chain payment processing for international clients - Automated investment strategies for received payments - Portfolio diversification across multiple blockchain networks - Systematic DCA for long-term investment goals ### Competitive Advantages 1. **True Cross-Chain Support**: Unlike competitors limited to single chains, DeWrap operates seamlessly across 9+ major networks 2. **1inch Integration**: Leverages the most advanced DEX aggregator for optimal swap routes and MEV protection 3. **Automation-First**: Built-in auto-swap and DCA capabilities reduce manual intervention 4. **Developer-Friendly**: Comprehensive API and smart contract architecture for easy integration 5. **User Experience**: Modern, intuitive interface that abstracts away blockchain complexity ### Business Model & Revenue Streams - Transaction fees on cross-chain swaps - Premium features for advanced users - API access for enterprise integrations - White-label solutions for businesses DeWrap essentially transforms the fragmented crypto payment landscape into a unified, automated, and user-friendly experience, making it as simple to accept crypto payments as traditional fiat payments while providing advanced features that only blockchain technology can enable.
How it's made
## How DeWrap Was Built: The Technical Deep Dive DeWrap is a sophisticated Web3 payment platform built with cutting-edge technologies and some clever architectural decisions. Here's the complete technical breakdown: ### **Monorepo Architecture with Turborepo** The project uses a **Turborepo monorepo** structure for optimal development experience: - **`apps/web`**: Next.js 15 frontend with React 19 - **`apps/contracts`**: Solidity smart contracts with Hardhat - **`apps/docs`**: Documentation site - **`packages/ui`**: Shared component library - **`packages/eslint-config`**: Unified linting rules - **`packages/typescript-config`**: Shared TypeScript configs This enables code sharing, consistent tooling, and parallel builds across the entire stack. ### **Frontend: Next.js 15 + React 19 + Modern Stack** **Core Technologies:** - **Next.js 15** with App Router for server-side rendering and API routes - **React 19** with concurrent features and improved performance - **TypeScript 5.8** for type safety across the entire application - **Tailwind CSS 4** with PostCSS for utility-first styling - **Radix UI** for accessible, unstyled components - **TanStack Query** for server state management and caching **Web3 Integration:** - **Wagmi v2** + **Reown's AppKit** for wallet connections and blockchain interactions - **Viem 2.x** for low-level Ethereum interactions - **Ethers.js 6.15** for smart contract interactions - Custom **AppKitProviderConnector** to bridge AppKit with 1inch Protocol ### **Smart Contracts: Solidity 0.8.27 + OpenZeppelin** **Core Contracts:** - **`DeWrap.sol`**: Main contract managing users, invoices, payouts, and investments - **`DewrapPaymentCollector.sol`**: Payment collection and processing logic - **`PaymentCollectorFactory.sol`**: Factory pattern for scalable deployment **Key Features:** - **ReentrancyGuard** for security against reentrancy attacks - **Ownable** pattern for administrative functions - **Event-driven architecture** for off-chain tracking - **Enum-based status management** for invoices and payouts - **Struct-based data organization** for complex relationships ### **Cross-Chain Infrastructure: 1inch Fusion Plus** This is where DeWrap gets really interesting. The platform leverages **1inch's Fusion Plus cross-chain API** for seamless token bridging and swapping: **Cross-Chain Flow:** 1. **Quote Generation**: Real-time pricing across 9+ networks 2. **Order Placement**: MEV-protected order submission 3. **Secret Management**: HashLock-based atomic swaps 4. **Fill Monitoring**: Automated secret submission for completed fills 5. **Status Tracking**: Real-time order status updates ### **Database: PostgreSQL + Prisma** **Schema Design:** - **User Management**: Clerk integration with custom user profiles - **Invoice System**: Flexible payment preferences and status tracking - **Payout Tracking**: Cross-chain transaction monitoring - **Metrics**: User performance and investment analytics **Key Features:** - **UUID-based primary keys** for security - **JSON metadata fields** for flexible data storage - **Indexed relationships** for performance - **Enum-based status tracking** for type safety **Webhook Integration:** - Real-time user synchronization - Secure webhook validation with Svix - Automatic profile updates ### **API Architecture: Next.js API Routes** **Key Endpoints:** - **`/api/quote`**: 1inch quote generation - **`/api/execute`**: Cross-chain transaction execution - **`/api/invoice`**: Invoice management - **`/api/payment`**: Payment processing - **`/api/cron/swap`**: Automated swap execution [COMING SOON]