Fixed asset borrowing configuration at initialization

This commit is contained in:
David Racero 2021-03-31 17:39:59 +02:00
parent ae8f7aa21f
commit ab14a0bc9d
2 changed files with 10 additions and 14 deletions

View File

@ -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);
}
}

View File

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