ZUniswapV2, a clone of UniswapV2 made in educational purposes
Using this repo
git clone [email protected]:Jeiwan/zuniswapv2.git
- Ensure you have installed Rust and Cargo: Install Rust
- Install Foundry:
cargo install --git https://github.com/gakonst/foundry --bin forge --locked
- Install dependency contracts:
git submodule update --init --recursive
- Run tests:
forge test
Blog posts
- Part 1, architecture of UniswapV2, adding liquidity, first tests in Solidity, removing liquidity.
- Part 2, tokens swapping, re-entrancy attacks and protection, price oracle, integer overflow and underflow, safe transfer.
- Part 3, factory contract, CREATE2 opcode, Router contract, Library contract
- Part 4, LP-tokens burning bug, liquidity removal, output amount calculation, swapExactTokensForTokens, swapTokensForExactTokens, fixing swap fee bug, flash loans, fixing re-entrancy vulnerability, protocol fees