Uniswap V4 DEX / Token Swap Platform — Full Source Code with Smart Contracts
Launch Your Own DEX — Earn Fees on Every Swap
Description
Complete DeFi Exchange Script | Uniswap V4 Hook-Based DEX Clone | Ready to Deploy
What You Get
A complete, production-ready decentralized exchange (DEX) built on top of Uniswap V4 — the latest version of the world's leading swap protocol. This is a full-stack DeFi application with custom smart contracts, a modern swap interface, and a built-in commission system that lets you earn fees on every trade.
Unlike basic Uniswap forks, this DEX uses Uniswap V4's powerful hook system to automatically extract a commission on every swap — giving you a real revenue stream from day one.
Download the ZIP, deploy, and start earning.
Key Features
Built-In Revenue System
- Automatic commission extraction on every swap (default 1%, configurable up to 10%)
- Set custom commission rates per trading pool
- Withdraw accumulated fees directly to your wallet
- Full admin dashboard to manage rates and monitor earnings
Professional Swap Interface
- Sleek dark-themed UI with animated effects
- Real-time price quotes before every trade
- Single-hop and multi-hop (multi-pool) swap routing
- Slippage tolerance and transaction deadline protection
- Gas estimation on every quote
- Mobile responsive design
Liquidity Management
- Create new trading pools for any ERC-20 token pair
- Add liquidity — full range or custom price range (concentrated liquidity)
- Remove liquidity positions
- Pool state monitoring and position tracking
Wallet Support
- MetaMask, WalletConnect, Coinbase Wallet, Ledger, and 300+ wallets
- Powered by Reown AppKit (formerly WalletConnect)
- One-click connect with network switching
Admin / Owner Controls
- Set global or per-pool commission rates
- Pause and unpause all swaps (emergency stop)
- Withdraw accumulated protocol fees
- Secure two-step ownership transfer
Security
- Two-step ownership transfer (prevents accidental loss of control)
- Emergency pause functionality
- Slippage protection on all swaps
- Transaction deadline validation
- Fully tested — 88 unit tests + mainnet fork tests
How It Works
- You deploy the smart contracts to Ethereum mainnet, Base, Arbitrum, or any EVM chain where Uniswap V4 is live
- You create trading pools for token pairs you want to support (ETH/USDC, ETH/USDT, etc.)
- Users swap tokens through your branded frontend
- Your hook automatically extracts a commission on every single trade
- You withdraw your earnings whenever you want
The commission is taken at the smart contract level — transparent, trustless, and automatic. No backend server needed.
What's Included
Full Source Code (ZIP Download)
├── Smart Contracts (Solidity)
│ ├── CommissionHook — Swap hook with commission extraction
│ ├── CommissionRouter — Single & multi-hop swap routing
│ ├── CommissionQuoter — Real-time price quote engine
│ └── CommissionPoolManager — Pool creation & liquidity management
│
├── Frontend (Next.js)
│ ├── Swap interface with live quotes
│ ├── Liquidity / Pools dashboard
│ ├── Wallet connection (300+ wallets)
│ ├── Admin controls panel
│ └── Built-in documentation page
│
├── Deployment Scripts
│ ├── Local development (Anvil/Foundry)
│ ├── Testnet (Sepolia) with mock tokens
│ └── Mainnet (deterministic CREATE2 deployment)
│
├── Test Suite — 88 unit tests + fork tests
├── Full HTML Documentation — single-page, offline-ready
└── Environment configuration templates
Tech Stack
| Layer | Technology |
|---|---|
| Smart Contracts | Solidity 0.8.26 |
| Protocol | Uniswap V4 (Hooks) |
| Contract Framework | Foundry (Forge, Cast, Anvil) |
| Frontend | Next.js 16, React 19, TypeScript |
| Styling | Tailwind CSS |
| Web3 Integration | wagmi v3, viem v2 |
| Wallet Connection | Reown AppKit (WalletConnect) |
| Testing | Foundry (Solidity), Vitest (Frontend) |
| EVM Target | Cancun (latest) |
Supported Chains
Works on any EVM chain where Uniswap V4 is deployed:
- Ethereum Mainnet
- Base
- Arbitrum
- Optimism
- Polygon
- Sepolia (testnet — included with mock tokens)
Requirements
- Node.js 18+ (for frontend)
- Foundry (for smart contract compilation and deployment)
- A funded wallet with ETH for deployment gas
- Reown Project ID (free at cloud.reown.com — for wallet connection)
- Basic knowledge of smart contract deployment
No server required. No database. No backend. Pure Web3.
Easy Customization
- Change commission rate — single variable in the deployment script
- Add new tokens — add token address to the frontend config file
- Add new chains — add chain config and contract addresses
- Rebrand — change name, colors, and logo in the frontend
- Extend the hook — add custom logic (referral fees, volume discounts, etc.)
Quick Start
- Download and extract the ZIP
- Install Foundry and Node.js
- Configure your
.envwith private key and RPC URL - Deploy contracts with one Foundry command
- Update frontend config with your contract addresses
- Deploy frontend to Vercel, Netlify, or any static host
- Start earning commissions on every swap
Full step-by-step documentation is included in the download.
Demo
Live testnet demo deployed on Sepolia with test tokens (ETH, USDT, USDC, DAI).
Disclaimer: Web3.Market is a marketplace platform that facilitates the sale of digital products between independent sellers and buyers. We do not develop, endorse, or guarantee any product listed on this platform. All products are provided by third-party sellers and are sold "as is." Web3.Market assumes no responsibility or liability for the functionality, security, legality, or any use or misuse of products purchased through this platform. Buyers are solely responsible for evaluating the suitability of any product for their intended purpose and for ensuring compliance with all applicable laws and regulations. By purchasing, you acknowledge that Web3.Market shall not be held liable for any direct, indirect, incidental, or consequential damages arising from the use of any product.
One-time payment • Lifetime access
Product Info
RPC Providers
Need a reliable RPC endpoint for your dApp? Get started with these trusted providers:
