- Single-Asset folding strategies
Tests can be ran 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 globeContract = await ethers.getContractAt("SnowGlobeBenqiWbtc", snowglobeAddr, governanceSigner);
To simulate the deployment of a new strategy, use the following:
const stratFactory = await ethers.getContractFactory("StrategyBenqiWbtc");
const deployedStrat = await stratFactory.deploy(governanceAddr, strategistAddr, controllerAddr, timelockAddr);
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. Last checked, node.snowapi.net wasn't compatible. 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.