Please read and get familiar with Vesper. This repository contains set of smart contracts and test cases of Vesper pools.
-
Install
git clone https://github.com/vesperfi/vesper-pools.git cd vesper-pools nvm use npm install -
set NODE_URL in env
export NODE_URL=<eth mainnet url>
-
Compile
npm run compile
-
Test
Note: These tests will fork the mainnet as required in step 3. It is not recommended to run all tests at once, but rather to specify a single file.
- Run single file
npm test test/veth/aave-maker-compound-maker.js- Or run them all (but some will fail, because of state modifications to the forked chain)
npm testCoverage will launch its own in-process ganache server, so all you need to run is below command.
npm run coverageCoverage for one file
npm run coverage -- --testfiles "<<filename>>"
Deployment will be done via custom hardhat task deploy-core-contracts which behind the scene uses deploy scripts created using hardhat-deploy
-
Help
npx hardhat help deploy-core-contracts -
Deploy Vesper pool
- Add pool configuration in
./helper/mainnet/poolConfig.jsfile.- Some default config for setup and rewards are already defined at top of file, override them as needed.
- Replace mainnet in
./helper/mainnet/poolConfig.jswith arbitrum/avalanche/polygon as needed.
Example configuration for
VDAIVDAI: { contractName: 'VPool', poolParams: ['vDAI Pool', 'vDAI', Address.DAI], setup: { ...setup }, rewards: { ...rewards }, },
- Run below command to deploy pool on localhost and mainnet as target chain
npm run deploy -- --pool VDAI --network localhost --deploy-params '{"tags": "deploy-vPool"}'- To deploy pool on localhost and polygon as target chain, run below command
npm run deploy -- --pool VDAI --network localhost --deploy-params '{"tags": "deploy-vPool"}' --target-chain polygon - Add pool configuration in
-
Deploy pool with release (preferred)
- It will create
contracts.jsonfile at/releases/3.0.15
npm run deploy -- --pool VDAI --network localhost --release 3.0.15 --deploy-params '{"tags": "deploy-vPool"}' - It will create
-
Deploy strategy for already deployed pool
- Add strategy configuration in
./helper/mainnet/strategyConfig.jsfile.
Example configuration for
AaveStrategyDAIAaveStrategyDAI: { contract: 'AaveStrategy', type: StrategyTypes.AAVE, constructorArgs: { swapManager, receiptToken: Address.Aave.aDAI, strategyName: 'AaveStrategyDAI', }, config: { ...config }, setup: { ...setup }, },
- Run below command to deploy
AaveStrategyDAIforVDAIpool.multisig-nonceparameter is optional parameters to propose multisig transaction
npm run deploy -- --pool VDAI --network localhost --release 3.0.15 --deploy-params '{"tags": "deploy-strategy"}' --strategy-name AaveStrategyDAI --multisig-nonce 0 - Add strategy configuration in
-
Migrate strategy
npm run deploy -- --pool VDAI --network localhost --release 3.0.15 --deploy-params '{"tags": "migrate-strategy"}' --strategy-name AaveStrategyDAIUse
old-strategy-nameoptional parameter if strategy name is changed. -
Pass any
hardhat-deploysupported param withindeploy-paramsobjectnpm run deploy -- --pool VDAI --network localhost --release 3.0.15 --deploy-params '{"tags": "deploy-vPool", "gasprice": "25000000000"}'
* Deploy `upgrader` contracts
mandatory param `name`, supported values : `PoolAccountantUpgrader`, `PoolRewardsUpgrader`, `VPoolUpgrader`
optional param `--target-chain`, values : `polygon`, `mainnet`, `avalanche`, `arbitrium`
```bash
npm run deploy-upgrader -- --name PoolAccountantUpgrader --network localhost
npm run deploy-upgrader -- --name PoolRewardsUpgrader --network localhost --target-chain polygon