From cb804585a6d8ce11619ba5fa1bd08e035cc11aaa Mon Sep 17 00:00:00 2001 From: The3D Date: Tue, 18 May 2021 12:38:17 +0200 Subject: [PATCH] fix: finalized configuration of AAVE in Aave pro --- helpers/contracts-deployments.ts | 7 +++---- helpers/types.ts | 2 +- markets/aave-pro/index.ts | 4 ++-- markets/aave-pro/rateStrategies.ts | 13 ++++++++++++- markets/aave-pro/reservesConfigs.ts | 20 ++++++++++---------- tasks/full/2_lending_pool.ts | 4 ++-- 6 files changed, 30 insertions(+), 20 deletions(-) diff --git a/helpers/contracts-deployments.ts b/helpers/contracts-deployments.ts index 2d038cba..76781a8a 100644 --- a/helpers/contracts-deployments.ts +++ b/helpers/contracts-deployments.ts @@ -202,6 +202,7 @@ export const deployLendingPool = async (verify?: boolean, lendingPoolImpl?: eCon default: instance = await new LendingPoolFactory(libraries, await getFirstSigner()).deploy(); } + await instance.deployTransaction.wait(); await insertContractAddressInDb(eContractid.LendingPoolImpl, instance.address); return withSaveAndVerify(instance, eContractid.LendingPool, [], verify); @@ -367,15 +368,13 @@ export const deployStableDebtTokenByType = async (type: string) => { return deployGenericStableDebtToken(); } - console.log("Deploying instance of ", type); - switch(type) { case eContractid.StableDebtToken: return deployGenericStableDebtToken(); case eContractid.PermissionedStableDebtToken: return deployPermissionedStableDebtToken(); default: - console.log("[stable]Cant find token type ", type); + console.log("Cant find the debt token type ", type); throw "Invalid debt token type"; } } @@ -415,7 +414,7 @@ export const deployPermissionedVariableDebtToken = async () => false ); - export const deployGenericStableDebtToken = async () => + export const deployGenericStableDebtToken = async () => withSaveAndVerify( await new StableDebtTokenFactory(await getFirstSigner()).deploy(), eContractid.StableDebtToken, diff --git a/helpers/types.ts b/helpers/types.ts index b896ee8a..11249201 100644 --- a/helpers/types.ts +++ b/helpers/types.ts @@ -276,7 +276,7 @@ export type iAavePoolAssets = Pick< export type iAaveProPoolAssets = Pick< iAssetsWithoutUSD, - 'USDC' | 'USDT' | 'WBTC' | 'WETH' + 'USDC' | 'WBTC' | 'WETH' | 'AAVE' >; export type iLpPoolAssets = Pick< diff --git a/markets/aave-pro/index.ts b/markets/aave-pro/index.ts index 7d06757b..c660095c 100644 --- a/markets/aave-pro/index.ts +++ b/markets/aave-pro/index.ts @@ -3,8 +3,8 @@ import { IAaveProConfiguration, eEthereumNetwork, eContractid } from '../../help import { CommonsConfig } from './commons'; import { + strategyAAVE, strategyUSDC, - strategyUSDT, strategyWBTC, strategyWETH, } from './reservesConfigs'; @@ -20,9 +20,9 @@ export const AaveConfig: IAaveProConfiguration = { LendingPoolImpl: eContractid.PermissionedLendingPool, ReservesConfig: { USDC: strategyUSDC, - USDT: strategyUSDT, WBTC: strategyWBTC, WETH: strategyWETH, + AAVE: strategyAAVE }, ReserveAssets: { [eEthereumNetwork.buidlerevm]: {}, diff --git a/markets/aave-pro/rateStrategies.ts b/markets/aave-pro/rateStrategies.ts index 47530b5c..0e80d92c 100644 --- a/markets/aave-pro/rateStrategies.ts +++ b/markets/aave-pro/rateStrategies.ts @@ -3,7 +3,7 @@ import { oneRay } from '../../helpers/constants'; import { IInterestRateStrategyParams } from '../../helpers/types'; -// USDC USDT +// USDC export const rateStrategyStable: IInterestRateStrategyParams = { name: "rateStrategyStable", optimalUtilizationRate: new BigNumber(0.9).multipliedBy(oneRay).toFixed(), @@ -14,6 +14,17 @@ export const rateStrategyStable: IInterestRateStrategyParams = { stableRateSlope2: new BigNumber(0.60).multipliedBy(oneRay).toFixed(), } +// AAVE +export const rateStrategyAAVE: IInterestRateStrategyParams = { + name: "rateStrategyAAVE", + optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(), + baseVariableBorrowRate: '0', + variableRateSlope1: '0', + variableRateSlope2: '0', + stableRateSlope1: '0', + stableRateSlope2: '0', +} + // WETH export const rateStrategyWETH: IInterestRateStrategyParams = { name: "rateStrategyWETH", diff --git a/markets/aave-pro/reservesConfigs.ts b/markets/aave-pro/reservesConfigs.ts index ad950062..f7f2f86d 100644 --- a/markets/aave-pro/reservesConfigs.ts +++ b/markets/aave-pro/reservesConfigs.ts @@ -1,6 +1,6 @@ import { eContractid, IReserveParams } from '../../helpers/types'; -import { rateStrategyStable, rateStrategyWETH, rateStrategyWBTC } from './rateStrategies'; +import { rateStrategyStable, rateStrategyWETH, rateStrategyWBTC, rateStrategyAAVE } from './rateStrategies'; export const strategyUSDC: IReserveParams = { strategy: rateStrategyStable, @@ -16,18 +16,18 @@ export const strategyUSDC: IReserveParams = { reserveFactor: '1000', }; -export const strategyUSDT: IReserveParams = { - strategy: rateStrategyStable, - baseLTVAsCollateral: '8000', - liquidationThreshold: '8500', - liquidationBonus: '10500', - borrowingEnabled: true, - stableBorrowRateEnabled: true, - reserveDecimals: '6', +export const strategyAAVE: IReserveParams = { + strategy: rateStrategyAAVE, + baseLTVAsCollateral: '5000', + liquidationThreshold: '6500', + liquidationBonus: '11000', + borrowingEnabled: false, + stableBorrowRateEnabled: false, + reserveDecimals: '18', aTokenImpl: eContractid.AToken, stableDebtTokenImpl: eContractid.PermissionedStableDebtToken, variableDebtTokenImpl: eContractid.PermissionedVariableDebtToken, - reserveFactor: '1000', + reserveFactor: '0' }; export const strategyWETH: IReserveParams = { diff --git a/tasks/full/2_lending_pool.ts b/tasks/full/2_lending_pool.ts index 24df6159..c65d2144 100644 --- a/tasks/full/2_lending_pool.ts +++ b/tasks/full/2_lending_pool.ts @@ -16,7 +16,7 @@ import { import { HardhatRuntimeEnvironment } from 'hardhat/types'; import { loadPoolConfig, ConfigNames } from '../../helpers/configuration'; -task('full:deploy-lending-pool', 'Deploy lending pool for dev enviroment') +task('full:deploy-lending-pool', 'Deploy lending pool for dev environment') .addFlag('verify', 'Verify contracts at Etherscan') .addParam('pool', `Pool name to retrieve configuration, supported: ${Object.values(ConfigNames)}`) .setAction(async ({ verify, pool }, DRE: HardhatRuntimeEnvironment) => { @@ -34,7 +34,7 @@ task('full:deploy-lending-pool', 'Deploy lending pool for dev enviroment') console.log('\tDeploying new lending pool implementation & libraries...'); const lendingPoolImpl = await deployLendingPool(verify, poolConfig.LendingPoolImpl); lendingPoolImplAddress = lendingPoolImpl.address; - await lendingPoolImpl.initialize(addressesProvider.address); + await waitForTx(await lendingPoolImpl.initialize(addressesProvider.address)); } console.log('\tSetting lending pool implementation with address:', lendingPoolImplAddress); // Set lending pool impl to Address provider