Skip to content
This repository has been archived by the owner on May 2, 2023. It is now read-only.

Latest commit

 

History

History
131 lines (107 loc) · 4.07 KB

README.md

File metadata and controls

131 lines (107 loc) · 4.07 KB

Vesper Pools

Please read and get familiar with Vesper. This repository contains set of smart contracts and test cases of Vesper pools.

Setup

  1. Install

    git clone https://github.com/vesperfi/vesper-pools.git
    cd vesper-pools
    nvm use
    npm install
  2. set NODE_URL in env

    export NODE_URL=<eth mainnet url>
  3. Compile

    npm run compile
  4. 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

Run test with coverage

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>>"

Deploy

Deployment will be done via custom hardhat task deploy-core-contracts which behind the scene uses deploy scripts created using hardhat-deploy

Usage

  • Help

    npx hardhat help deploy-core-contracts
  • Deploy Vesper pool

    1. 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 },
    },
    1. 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
  • 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"}'
  • Deploy strategy for already deployed pool

    1. 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 },
     },
    1. Run below command to deploy AaveStrategyDAI for VDAI 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
  • 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 within deploy-params object

     npm 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