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
yarn add @uniswap/lib
yarn add @uniswap/v2-core
yarn add @uniswap/v2-periphery
Before running the tests make sure to change the init code from:
node_modules/@uniswap/v2-periphery/contracts/libraries/UniswapV2Library.sol at line 24
from
96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f
to
e699c2c70a1e9ca16c58b40782745b5d609738b755845b6ee18a18d21352f753
Compile the smart contracts with Hardhat:
$ npx hardhat compile
Compile the smart contracts and generate TypeChain artifacts:
$ yarn run typechain
Lint the Solidity code:
$ yarn lint:sol
Lint the TypeScript code:
$ yarn lint:ts
Run the Mocha tests:
$ npx hardhat test
Generate the code coverage report:
$ yarn add hardhat-coverage
$ npx hardhat coverage --testfiles "./test"
Delete the smart contract artifacts, the coverage reports and the Hardhat cache:
$ npx hardhat clean
If you use VSCode, you can enjoy syntax highlighting for your Solidity code via the hardhat-vscode extension.
CustomRouterV3 - the scope of this repo
The rest of contracts are made only to simulate the behavior of router in tests
These contracts are not audited, use at your own risk!