stoneworld / zuniswapv2

UniswapV2 clone made in educational purposes

Home Page:https://jeiwan.net/posts/programming-defi-uniswapv2-1/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ZUniswapV2, a clone of UniswapV2 made in educational purposes

Using this repo

  1. git clone git@github.com:Jeiwan/zuniswapv2.git
  2. Ensure you have installed Rust and Cargo: Install Rust
  3. Install Foundry: cargo install --git https://github.com/gakonst/foundry --bin forge --locked
  4. Install dependency contracts: git submodule update --init --recursive
  5. Run tests: forge test

Update Factory code hash

$ forge inspect ZuniswapV2Pair bytecode| xargs cast keccak

Blog posts

  1. Part 1, architecture of UniswapV2, adding liquidity, first tests in Solidity, removing liquidity.
  2. Part 2, tokens swapping, re-entrancy attacks and protection, price oracle, integer overflow and underflow, safe transfer.
  3. Part 3, factory contract, CREATE2 opcode, Router contract, Library contract
  4. 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

About

UniswapV2 clone made in educational purposes

https://jeiwan.net/posts/programming-defi-uniswapv2-1/


Languages

Language:Solidity 99.9%Language:Makefile 0.1%