A decentralized exchange (DEX) inspired by Uniswap V1, built with Solidity and tested using Foundry. This project replicates the core functionalities of Uniswap V1, including liquidity provision, token swapping, and price discovery, to provide a deeper understanding of how automated market makers (AMMs) work in decentralized finance (DeFi).
- Token Swapping: Swap between ERC20 tokens and Ether using the AMM model.
- Liquidity Provision: Add and remove liquidity for ERC20/Ether pairs.
- Price Discovery: Determine token prices based on the constant product formula ( x * y = k ).
- Solidity: Smart contract development.
- Foundry: A fast and modular testing framework.
- OpenZeppelin: Standard ERC20 token implementation.
- Foundry installed.
- Node.js (for dependency management).
- A basic understanding of Solidity and AMMs.
- Clone the Repository
git clone https://github.com/arnavkirti/UniSwap-V1 cd UniSwap-V1
- Install dependencies
forge install
- Build the Project
forge build
- Token.sol - 0x371BCFCC65a1A7C95bA5261D247b2D820f0b05f5
- Exchange.sol - 0x36269441df3591abEE04526eBe3F3cafE07350e5
This project was inspired by the Uniswap V1 whitepaper and implementation:
Also, LearnWeb3.io tutorials were very helpful in building this.