From ab14a0bc9d61ac146a0c670a4e6b992c2de6792a Mon Sep 17 00:00:00 2001 From: David Racero Date: Wed, 31 Mar 2021 17:39:59 +0200 Subject: [PATCH] Fixed asset borrowing configuration at initialization --- contracts/deployments/ATokensAndRatesHelper.sol | 11 +++++++---- helpers/init-helpers.ts | 13 +++---------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/contracts/deployments/ATokensAndRatesHelper.sol b/contracts/deployments/ATokensAndRatesHelper.sol index 400f7ca6..2cac535b 100644 --- a/contracts/deployments/ATokensAndRatesHelper.sol +++ b/contracts/deployments/ATokensAndRatesHelper.sol @@ -32,6 +32,7 @@ contract ATokensAndRatesHelper is Ownable { uint256 liquidationBonus; uint256 reserveFactor; bool stableBorrowingEnabled; + bool borrowingEnabled; } constructor( @@ -73,10 +74,12 @@ contract ATokensAndRatesHelper is Ownable { inputParams[i].liquidationBonus ); - configurator.enableBorrowingOnReserve( - inputParams[i].asset, - inputParams[i].stableBorrowingEnabled - ); + if (inputParams[i].borrowingEnabled) { + configurator.enableBorrowingOnReserve( + inputParams[i].asset, + inputParams[i].stableBorrowingEnabled + ); + } configurator.setReserveFactor(inputParams[i].asset, inputParams[i].reserveFactor); } } diff --git a/helpers/init-helpers.ts b/helpers/init-helpers.ts index 3b69badf..acf17c02 100644 --- a/helpers/init-helpers.ts +++ b/helpers/init-helpers.ts @@ -271,11 +271,6 @@ export const configureReservesByHelper = async ( const atokenAndRatesDeployer = await getATokensAndRatesHelper(); const tokens: string[] = []; const symbols: string[] = []; - const baseLTVA: string[] = []; - const liquidationThresholds: string[] = []; - const liquidationBonuses: string[] = []; - const reserveFactors: string[] = []; - const stableRatesEnabled: boolean[] = []; const inputParams: { asset: string; @@ -284,6 +279,7 @@ export const configureReservesByHelper = async ( liquidationBonus: BigNumberish; reserveFactor: BigNumberish; stableBorrowingEnabled: boolean; + borrowingEnabled: boolean; }[] = []; for (const [ @@ -294,6 +290,7 @@ export const configureReservesByHelper = async ( liquidationThreshold, reserveFactor, stableBorrowRateEnabled, + borrowingEnabled, }, ] of Object.entries(reservesParams) as [string, IReserveParams][]) { if (baseLTVAsCollateral === '-1') continue; @@ -321,15 +318,11 @@ export const configureReservesByHelper = async ( liquidationBonus: liquidationBonus, reserveFactor: reserveFactor, stableBorrowingEnabled: stableBorrowRateEnabled, + borrowingEnabled: borrowingEnabled, }); tokens.push(tokenAddress); symbols.push(assetSymbol); - baseLTVA.push(baseLTVAsCollateral); - liquidationThresholds.push(liquidationThreshold); - liquidationBonuses.push(liquidationBonus); - reserveFactors.push(reserveFactor); - stableRatesEnabled.push(stableBorrowRateEnabled); } if (tokens.length) { // Set aTokenAndRatesDeployer as temporal admin