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 test
Coverage will launch its own in-process ganache server, so all you need to run is below command.
npm run coverage
Coverage 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.js
file.- Some default config for setup and rewards are already defined at top of file, override them as needed.
- Replace mainnet in
./helper/mainnet/poolConfig.js
with arbitrum/avalanche/polygon as needed.
Example configuration for
VDAI
VDAI: { 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.json
file 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.js
file.
Example configuration for
AaveStrategyDAI
AaveStrategyDAI: { contract: 'AaveStrategy', type: StrategyTypes.AAVE, constructorArgs: { swapManager, receiptToken: Address.Aave.aDAI, strategyName: 'AaveStrategyDAI', }, config: { ...config }, setup: { ...setup }, },
- Run below command to deploy
AaveStrategyDAI
forVDAI
pool.multisig-nonce
parameter 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 AaveStrategyDAI
Use
old-strategy-name
optional parameter if strategy name is changed. -
Pass any
hardhat-deploy
supported param withindeploy-params
objectnpm 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