https://github.com/ricardomuchacho/uniswap-router-swaps
smart contract that integrates Uniswap's V2 Router to enable seamless token swaps on Arbitrum One
https://github.com/ricardomuchacho/uniswap-router-swaps
arbitrum defi foundry smart-contracts uniswap
Last synced: about 1 year ago
JSON representation
smart contract that integrates Uniswap's V2 Router to enable seamless token swaps on Arbitrum One
- Host: GitHub
- URL: https://github.com/ricardomuchacho/uniswap-router-swaps
- Owner: RicardoMuchacho
- License: mit
- Created: 2025-03-31T12:45:27.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-03-31T13:21:34.000Z (over 1 year ago)
- Last Synced: 2025-03-31T14:02:07.076Z (over 1 year ago)
- Topics: arbitrum, defi, foundry, smart-contracts, uniswap
- Language: Solidity
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: License.md
Awesome Lists containing this project
README
# 🔄 SwapApp - Uniswap V2 Router Integration on Arbitrum One
## 📌 Overview
SwapApp is a Solidity smart contract that integrates Uniswap's V2 Router to enable seamless token swaps on the Arbitrum One mainnet. The contract supports swaps between ERC-20 tokens and ETH, ensuring efficient and decentralized trading.
## ✨ Key Features
- **Uniswap V2 Integration**: Uses Uniswap V2 Router for decentralized swaps.
- **100% Test Coverage**: Ensures reliability and security.
- **Token-to-Token Swaps**: Swap one ERC-20 token for another.
- **ETH to Token Swaps**: Convert ETH to ERC-20 tokens.
- **Token to ETH Swaps**: Convert ERC-20 tokens to ETH.
## 📜 Contracts Overview
| Contract | Description |
|-----------|------------|
| `IV2Router` | Interface for interacting with Uniswap V2 Router functions. |
| `Swap` | Implements token swaps and ETH conversions using Uniswap V2 Router. |
### ⚙️ `Swap.sol` Contract Functions
| Function | Description |
|----------|------------|
| `swapTokens(uint256 amountIn_, uint256 amountOutMin_, address[] memory path_, uint256 deadline_)` | Swaps ERC-20 tokens for another ERC-20 token. |
| `swapETHForTokens(uint256 amountOutMin_, address[] memory path_, uint256 deadline_)` | Swaps ETH for ERC-20 tokens. |
| `swapTokensForETH(uint256 amountIn_, uint256 amountOutMin_, address[] memory path_, uint256 deadline_)` | Swaps ERC-20 tokens for ETH. |
| `getAmountOutHelper(uint256 amountIn_, address[] calldata path_)` | Helper function to fetch estimated output amount for a given input amount. |
## 🚀 Getting Started
1. Deploy `SwapApp` with the Uniswap V2 Router address on Arbitrum One.
2. Ensure that users approve token transfers before swapping.
3. Call the relevant swap function depending on the desired trade type.