- Liquidity pool tests
- Single sided tests
Tests can be run with the following:
npx hardhat test
To run the tests with a persistent state, you can change networks through inspecting MetaMask or run the following:
npx hardhat node
...and in another terminal window:
npx hardhat test --network localhost
npx hardhat console --network localhost
Many of the existing tests are running on already deployed contracted addresses and ABI files.
If there are valid .sol
files in the repository, but the contracts are already deployed, use the following:
const vaultContract = await ethers.getContractAt("VaultSushiWethDai", vaultAddr, governanceSigner);
Or, in their respective LPStrats, be sure to specify the vault address:
vaultAddress: <vault address>
To simulate the deployment of a new strategy, use the following:
const stratFactory = await ethers.getContractFactory("StrategySushiWethDai");
const deployedStrat = await stratFactory.deploy(governanceAddr, strategistAddr, controllerAddr, timelockAddr);
Or, in their respective LPStrats, be sure to specify the name and controller:
name: "SushiWethDai",
controller: "sushi"
This code will create a factory, and through deploy()
create an instance of that contract.
These tests use hardhat's overwrite functionality to give accounts token balances. To accomplish this, we need to specify which memory slot to overwrite in the token's contract on the forked chain.
After the above is installed, complete the following
- Run a local hardhat instance
npx hardhat node
- call
slot20 balanceOf {contract_addr} {balance_holder_addr} -v
e.g. - Add slot number to helpers::findSlot() function
N.B If you are getting errors make sure you are pointing to a full archive node in the RPC address.
N.N.B. If you are finding it hard to find an account with active balance of said token, you can always use a few dollars worth of real money to acquire token and restart the hardhat node.