Before running any command, make sure to install dependencies from terminal inside working dir:
npm install
set .env file in root dir accordingly
ETH_MAINNET= <url to mainnet node>
ETH_SEPOLIA= <url to sepolia node>
DEPLOY_KEY= <account private key> NOTE: be sure to have some ETH on this account on sepolia
Run the tests from project root dir with following commands:
npx hardhat test tests/test.local.ts
npx hardhat test tests/test.sepolia.ts --network sepolia
About tests:
npx hardhat test tests/test.local.ts -> executes against hardhat node forked mainnet
npx hardhat test tests/test.sepolia.ts -> executes against deployed contract on sepolia
Tested on sepolia:
DAI - 0xFF34B3d4Aee8ddCd6F9AFFFB6Fe49bD371b8a357
minOut == 0
This is too ensure transaction passes on swap as uniswap pools on sepolia are not very healthy
If minOut is not satisifed tx will revert on uniswap router
If minOut is set to 0, there is a validation of price against oracle, event is emitted depending if price is fair or not
Swapper address on sepolia: 0xBa2C7AB80B0A2E79aA04e9F29466409f5CEd1C1A