One-click Uniswap fork script 2025 (For both Local and Mainnet development)
last update : 27/08/2025
A streamlined, one-click solution for forking Uniswap V2 contracts on both local development environments and mainnet. This script automates the entire setup process, from project initialization to contract deployment, making it easy to create your own decentralized exchange.
Demo video : https://www.youtube.com/watch?v=LcwpIvLqIIo&t=5s
What it does?
π One-Click Setup
- Local Development: Run ./local.sh
for a complete local Uniswap V2 fork setup
- Mainnet Deployment: Run ./mainnet.sh
to deploy the fork to Ethereum OR any EVM compatible mainnet
- Zero Configuration: Minimal setup required - just fill in your environment variables OR change the network if needed
π§ Automated Workflow
1. Project Initialization: Creates Hardhat project with proper configuration
2. Dependency Management: Installs all required Uniswap V2 dependencies
3. Contract Cloning: Downloads official Uniswap V2 Core and Periphery contracts, applies required fixes
4. Smart Contract Deployment: Deploys Factory, WETH, Router, and test tokens
5. Address Tracking: Automatically saves all contract addresses to addresses.txt
π οΈ What Gets Deployed
- UniswapV2Factory: Core factory contract for creating trading pairs
- WETH9: Wrapped Ether contract
- UniswapV2Router02: Router contract for swaps and liquidity operations
- TokenA & TokenB: Test ERC20 tokens for immediate testing
Prerequisites
- Node.js and npm installed
- Git installed
- For mainnet: Ethereum wallet with ETH for gas fees
After running either script, you'll have:
- β Complete Hardhat project setup
- β All Uniswap V2 contracts compiled and ready
- β Deployed Factory, WETH, Router, and test tokens
- β
addresses.txt
with all contract addresses
- β Ready-to-use DEX infrastructure
## Perfect For
- Developers wanting to build on Uniswap V2
- Projects needing their own DEX
- Learning how Uniswap V2 works
- Testing DeFi applications locally
- Production deployments with custom modifications
Get your own Uniswap V2 fork running in minutes, not weeks.
Pack of .sh scripts for local and mainnet Uniswap forking