FireSwap - Full-Stack Decentralized Exchange | DEX Clone Script with Smart Contracts, Yield Farming & Liquidity Pools
Ready-to-Deploy DeFi Exchange for Any EVM Blockchain
Description
Ready-to-Deploy DeFi Exchange for Any EVM Blockchain
FireSwap is a production-ready, fully functional decentralized exchange (DEX) built on the PancakeSwap V2 architecture. It includes everything you need to launch your own DeFi swap platform — smart contracts, automated deployment scripts, and a complete Next.js frontend — all deployable to any EVM-compatible blockchain in under 30 minutes.
This is not a mockup or UI template. Every feature works on-chain: token swaps, liquidity pools, yield farming, staking pools, lottery, and price predictions. Smart contracts deploy with a single command. The frontend auto-configures itself to your deployed contract addresses.
What's Included
Smart Contracts (Solidity, Hardhat)
| Contract | Description |
|---|---|
| PancakeFactory | AMM factory — creates and indexes trading pairs |
| PancakeRouter | Swap router — handles token swaps, multi-hop routing, add/remove liquidity |
| PancakePair | Liquidity pool contract (ERC-20 LP tokens) with 0.2% swap fee |
| MasterChef | Yield farming — distributes reward tokens to LP stakers |
| SmartChef | Syrup staking pools — single-token staking with configurable rewards |
| CakeToken (ERC-20) | Governance/reward token — fully renameable to your own brand |
| SyrupBar | Staking wrapper token for governance |
| PancakeSwapLottery | On-chain lottery with configurable ticket price, prize brackets, and treasury fee |
| MockRandomNumberGenerator | Chainlink VRF-compatible RNG for lottery draws |
| PancakePredictionV2 | Binary price prediction game (Bull/Bear) with oracle integration |
| MockAggregator | Chainlink-compatible price oracle (replaceable with real Chainlink feeds) |
| ERC-721 NFT | NFT collection contract with batch minting |
| Multicall2 | Batch contract reads for frontend performance |
| WBNB | Wrapped native token |
| Mock BUSD / USDT | Test stablecoins for development and testnet deployment |
Total: 15+ auditable Solidity contracts covering the full DeFi stack.
Frontend (Next.js, React, TypeScript)
- Full swap interface with real-time price calculation and slippage control
- Liquidity pool management — add, remove, view positions
- Yield farming dashboard with APR display, harvest, and stake/unstake
- Syrup staking pools page
- Lottery page with ticket purchasing and round history
- Price prediction game (Bull/Bear)
- Wallet integration — MetaMask, WalletConnect, Trust Wallet, Binance Wallet
- Responsive design with dark theme
- Token list management
- Full documentation page at
/documentation.html
Deployment Automation
deploy.js— One-command deployment of all core contracts + initial liquidityupdate-frontend.js— Auto-patches frontend config with deployed addresses and chain IDpatch-sdk.js— Auto-patches the swap SDK for your deployed factory and chaindeploy-pools.js— Deploy additional staking poolsdeploy-prediction.js— Deploy prediction game with mock oracledeploy-nft.js— Deploy NFT collection and mint demo tokenssetup-testnet.js— Add liquidity, fund farms, create test data
No manual address copy-pasting. Deploy contracts, run the update script, start the frontend.
Key Features
Automated Market Maker (AMM) Constant-product AMM with 0.2% swap fee. Supports any ERC-20 token pair. Multi-hop routing finds the best price across all available pools automatically.
Liquidity Pools & LP Tokens Users provide liquidity to trading pairs and receive LP tokens representing their share. LP tokens are standard ERC-20 — composable with any DeFi protocol.
Yield Farming (MasterChef) Stake LP tokens to earn your platform's reward token. Configurable emission rate per block. Multiple farm pools with adjustable allocation points.
Staking Pools (SmartChef) Single-token staking. Stake your governance token, earn any ERC-20 reward. Configurable reward rate, start block, and end block.
On-Chain Lottery Fully on-chain lottery system. Configurable ticket price, discount tiers, prize distribution brackets, and treasury fee. Uses Chainlink VRF (or mock RNG for testing).
Price Predictions Binary options-style prediction game. Users bet on whether an asset's price will go up or down in the next round. Configurable round length, buffer period, min bet, and treasury cut. Pluggable oracle — works with Chainlink or any AggregatorV3-compatible feed.
NFT Support ERC-721 contract with batch minting. Extensible for NFT marketplace, profile pictures, or gamification.
White-Label Ready
Rename the governance token, swap colors, replace logos, update menu items. The frontend uses a central customDeployment flag — all branding changes are isolated to config files.
Supported Blockchains
Deploys to any EVM-compatible chain:
- BNB Smart Chain (BSC) — mainnet & testnet
- Ethereum — mainnet, Sepolia, Goerli
- Polygon (Matic)
- Avalanche C-Chain
- Fantom
- Arbitrum
- Optimism
- Base
- Cronos
- Any custom EVM chain
Just configure the RPC URL and chain ID in the .env file. The deployment scripts and frontend adapt automatically.
Tech Stack
| Layer | Technology |
|---|---|
| Smart Contracts | Solidity 0.4.18 / 0.5.16 / 0.6.6 / 0.6.12 / 0.8.4 |
| Contract Framework | Hardhat |
| Frontend | Next.js 12, React 17, TypeScript |
| UI Components | PancakeSwap UIKit (styled-components) |
| State Management | Redux Toolkit |
| Wallet Integration | Web3-React, ethers.js v5 |
| Styling | styled-components, dark theme |
| Deployment | Vercel, VPS, or any static host |
Deployment Requirements
- Node.js 14+ and npm/yarn
- Private key with native gas tokens (0.15–0.3 for full deployment)
- RPC endpoint for your target chain (public or private)
No Docker, no databases, no backend servers. The frontend talks directly to the blockchain.
How Deployment Works
# 1. Deploy all smart contracts
cd dex-contracts
npx hardhat run scripts/deploy.js --network yourNetwork
# 2. Auto-configure frontend with deployed addresses
node scripts/update-frontend.js
# 3. Patch the swap SDK for your chain
node scripts/patch-sdk.js
# 4. Start the frontend
cd ../fireswap-frontend
yarn install && yarn dev
All deployed contract addresses are saved to deployed-addresses.json. The update script reads this file and patches the frontend config automatically — no manual editing required.
What You Can Customize
| Setting | How |
|---|---|
| Token name & symbol | Edit CakeToken.sol constructor, redeploy |
| Swap fee | Modify PancakeLibrary.sol (default: 0.2%) |
| Farming emission rate | Set in deploy.js or call updateEmissionRate() |
| Staking pool rewards | Configure per-pool in deploy-pools.js |
| Lottery ticket price | Set when starting each round |
| Prediction round length | Set in deploy-prediction.js |
| Frontend branding | Colors in theme/colors.ts, logos in public/, menu in Menu/config/config.ts |
| Target blockchain | Change RPC URL and chain ID in .env |
Who Is This For
- Entrepreneurs launching a DeFi platform on any EVM chain
- Blockchain developers who need a working DEX codebase to build on
- Web3 studios offering white-label DEX deployment to clients
- DeFi projects that need a swap + farming + staking platform for their token ecosystem
- Educators teaching DeFi mechanics with real, deployable contracts
What This Is NOT
- This is not a SaaS platform — you own and host everything
- No ongoing fees, subscriptions, or revenue sharing
- Smart contracts are not audited — you should audit before mainnet production use
- No SubGraph indexer included — analytics/info pages require your own indexing setup
- NFT marketplace frontend requires external API backend (contracts are included)
File Structure
fireswap/
├── dex-contracts/ # Hardhat project
│ ├── contracts/
│ │ ├── core/ # Factory, Pair, ERC20
│ │ ├── periphery/ # Router
│ │ ├── farm/ # MasterChef, CakeToken, SyrupBar, SmartChef
│ │ ├── lottery/ # PancakeSwapLottery, RandomNumberGenerator
│ │ ├── prediction/ # PredictionV2, MockAggregator
│ │ ├── nft/ # ERC-721 collection
│ │ └── utils/ # Multicall2, WBNB, mock tokens
│ ├── scripts/ # Deploy + automation scripts
│ └── deployed-addresses.json # All contract addresses after deployment
│
├── fireswap-frontend/ # Next.js frontend
│ ├── src/
│ │ ├── views/ # Swap, Pools, Farms, Lottery, Predictions
│ │ ├── config/ # Tokens, contracts, farms, pools config
│ │ ├── state/ # Redux state management
│ │ └── components/ # UI components, menu, modals
│ └── public/
│ ├── images/ # Token icons, logos
│ └── documentation.html # Full deployment documentation
│
├── pancake-swap-core/ # Original core contracts (reference)
├── pancake-swap-periphery/ # Original periphery contracts (reference)
└── pancake-farm/ # Original farm contracts (reference)
Live Demo
Deployed on BSC Testnet: connect MetaMask to BSC Testnet (chain 97) to test all features with zero financial risk. https://fireswap-flax.vercel.app
Documentation: https://fireswap-flax.vercel.app/documentation.html
Delivery
Full source code delivered as a zip archive or GitHub repository. Includes all smart contracts, frontend code, deployment scripts, and documentation. No obfuscated code, no locked files — full ownership.
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:
