Skip to content

Create a DEX with the core functionality of Uniswap V1

Notifications You must be signed in to change notification settings

Softbinator/uniswap-v1

Repository files navigation

Uniswap-V1 Replica

Usage

Pre Requisites

Before running any command, you need to create a .env file and set a BIP-39 compatible mnemonic as an environment variable. Follow the example in .env.example. If you don't already have a mnemonic, use this website to generate one.

Then, proceed with installing dependencies:

yarn install
yarn add hardhat
yarn add hardhat-docgen

Compile

Compile the smart contracts with Hardhat:

$ npx hardhat compile

TypeChain

Compile the smart contracts and generate TypeChain artifacts:

$ yarn run typechain

Lint Solidity

Lint the Solidity code:

$ yarn lint:sol

Lint TypeScript

Lint the TypeScript code:

$ yarn lint:ts

Test

Run the Mocha tests:

$ npx hardhat test

Coverage

Generate the code coverage report:

$ yarn add hardhat-coverage
$ npx hardhat coverage --testfiles "./test"

Clean

Delete the smart contract artifacts, the coverage reports and the Hardhat cache:

$ npx hardhat clean

Deploy

Deploy the contracts to Rinkeby Network:

Token Contract

$ npx hardhat deploy:Token --network rinkeby

Factory Contract

$ npx hardhat deploy:Factory --network rinkeby

Verify Contract

Verify the contracts on Etherscan programatically:

Token Contract

$ npx hardhat verify <address_of_the_deployed_token_contract> --network rinkeby <name_of_the_token> <symbol_of_the_token> 

Factory Contract

$ npx hardhat verify <address_of_the_deployed_factory_contract> --network rinkeby

Syntax Highlighting

If you use VSCode, you can enjoy syntax highlighting for your Solidity code via the hardhat-vscode extension.