A simplified implementation of the UniSwap interface built with React, enabling users to swap tokens, add and remove liquidity, and interact with a simulated AMM (Automated Market Maker).
- Token Swapping: Exchange between various ERC-20 tokens with real-time price calculation
- Liquidity Management: Add and remove liquidity to trading pairs
- AMM Visualization: Interactive charts showing the constant product curve and simulations
- Wallet Integration: Connect with MetaMask and other wallets via RainbowKit
- Slippage Control: Set custom slippage tolerance for transactions
- Node.js (v14 or later)
- npm or yarn
- A web3 wallet (like MetaMask)
-
Clone the repository:
git clone https://github.com/yourusername/uniswap-frontend.git cd uniswap-frontend -
Install dependencies:
npm install # or yarn -
Start the development server:
npm run dev # or yarn dev -
Open your browser and navigate to
http://localhost:5173
src/
├── assets/ # Static assets like images
├── components/ # Reusable UI components
├── config/ # Configuration files
├── constants/ # Application constants
├── hooks/ # Custom React hooks
├── pages/ # Page components
├── App.jsx # Main application component
├── App.css # Global CSS
├── index.css # Global CSS
└── main.jsx # Application entry point
The Swap page allows users to exchange tokens. It features:
- Token selection dropdowns
- Amount inputs with automatic price calculation
- Price impact visualization
- Slippage tolerance settings
The Liquidity page enables users to add or remove liquidity from trading pairs:
- Tab-based interface for adding or removing liquidity
- Token pair selection
- Visual simulation of liquidity changes
- LP token management
Interactive components for visualizing the AMM mechanism:
AMMCurve: Displays the constant product curve (x * y = k)AMMSimulation: Shows how adding or removing liquidity affects the curve
Fetches token information including symbol, decimals, and user balance.
Handles the token swap logic, price calculations, and transaction execution.
Manages liquidity operations, including pair creation, adding liquidity, and removing liquidity.
- React: Frontend library
- Vite: Build tool and development server
- Tailwind CSS: Utility-first CSS framework
- ethers.js: Ethereum library
- RainbowKit: Wallet connection UI
- wagmi: React hooks for Ethereum
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by Uniswap
- Built as an educational project for cryptocurrency and DeFi concepts