This React application allows users to swap between ETH and USDC on the Ethereum Sepolia testnet / Ethereum mainnet using Uniswap V2 protocol.
- Connect to MetaMask wallet
- Swap ETH to USDC and USDC to ETH
- Real-time price updates
- Error handling and transaction status updates
- Node.js (v16 or later)
- yarn
- MetaMask browser extension
- Clone the repository:
- Install dependencies:
- Create a
.env
file in the root directory and copy content from
.env.local
(for testnet) (default).env.production
(for mainnet)
- Start the development server:
- Open http://localhost:3000 in your browser.
- Connect your MetaMask wallet to the Sepolia testnet.
- Click "Connect to MetaMask" in the app.
- Enter the amount of ETH or USDC you want to swap.
- Click "Swap" and confirm the transaction in MetaMask.
The application uses the following Sepolia testnet addresses:
- Uniswap V2 Router: 0xC532a74256D3Db42D0Bf7a0400fEFDbad7694008
- USDC: 0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238
- WETH: 0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9
These can be modified in the src/config.js
file if needed.
- The main swap logic is implemented in
src/components/SwapInterface.tsx
. - Wallet connection is handled in
src/components/WalletConnection.tsx
. - The application uses web3-react for Ethereum interactions.
To build the app for production:
This creates a build
folder with the production-ready application.
This project is licensed under the MIT License.
Use at your own risk on the Sepolia testnet. Do not use with real assets on mainnet without proper auditing and testing.