The following assumes the use of node@>=10
.
yarn
yarn compile
Create '.env' from the env.template in the root project directory (optionally create a free infura.io account). Start your local ethereum chain.
yarn ganache-cli --mnemonic "your 12 word seed phrase" --defaultBalanceEther 10000
Deploy all contracts
yarn deploy
yarn test
The 'UniswapV2Factory.sol' contract relies on the CREATE2 opcode for deterministc pair address creation. In order to calculate the pair address without making any external calls, the keccak hash of the bytecode of the 'UniswapV2Pair.sol' has to be hard-coded into 'UniswapV2Library.sol'. Unfortunately, the bytecode of a contract heavly depends on the solc compiler settings and version. Make sure that correct hash code is written to 'UniswapV2Library.sol' before deploying to any non-local network. Run
python3 verify_code_hash.py
to help with the verification process.