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 liquidationBonus;
uint256 reserveFactor; uint256 reserveFactor;
bool stableBorrowingEnabled; bool stableBorrowingEnabled;
bool borrowingEnabled;
} }
constructor( constructor(
@ -73,10 +74,12 @@ contract ATokensAndRatesHelper is Ownable {
inputParams[i].liquidationBonus inputParams[i].liquidationBonus
); );
configurator.enableBorrowingOnReserve( if (inputParams[i].borrowingEnabled) {
inputParams[i].asset, configurator.enableBorrowingOnReserve(
inputParams[i].stableBorrowingEnabled inputParams[i].asset,
); inputParams[i].stableBorrowingEnabled
);
}
configurator.setReserveFactor(inputParams[i].asset, inputParams[i].reserveFactor); configurator.setReserveFactor(inputParams[i].asset, inputParams[i].reserveFactor);
} }
} }

View File

@ -271,11 +271,6 @@ export const configureReservesByHelper = async (
const atokenAndRatesDeployer = await getATokensAndRatesHelper(); const atokenAndRatesDeployer = await getATokensAndRatesHelper();
const tokens: string[] = []; const tokens: string[] = [];
const symbols: string[] = []; const symbols: string[] = [];
const baseLTVA: string[] = [];
const liquidationThresholds: string[] = [];
const liquidationBonuses: string[] = [];
const reserveFactors: string[] = [];
const stableRatesEnabled: boolean[] = [];
const inputParams: { const inputParams: {
asset: string; asset: string;
@ -284,6 +279,7 @@ export const configureReservesByHelper = async (
liquidationBonus: BigNumberish; liquidationBonus: BigNumberish;
reserveFactor: BigNumberish; reserveFactor: BigNumberish;
stableBorrowingEnabled: boolean; stableBorrowingEnabled: boolean;
borrowingEnabled: boolean;
}[] = []; }[] = [];
for (const [ for (const [
@ -294,6 +290,7 @@ export const configureReservesByHelper = async (
liquidationThreshold, liquidationThreshold,
reserveFactor, reserveFactor,
stableBorrowRateEnabled, stableBorrowRateEnabled,
borrowingEnabled,
}, },
] of Object.entries(reservesParams) as [string, IReserveParams][]) { ] of Object.entries(reservesParams) as [string, IReserveParams][]) {
if (baseLTVAsCollateral === '-1') continue; if (baseLTVAsCollateral === '-1') continue;
@ -321,15 +318,11 @@ export const configureReservesByHelper = async (
liquidationBonus: liquidationBonus, liquidationBonus: liquidationBonus,
reserveFactor: reserveFactor, reserveFactor: reserveFactor,
stableBorrowingEnabled: stableBorrowRateEnabled, stableBorrowingEnabled: stableBorrowRateEnabled,
borrowingEnabled: borrowingEnabled,
}); });
tokens.push(tokenAddress); tokens.push(tokenAddress);
symbols.push(assetSymbol); symbols.push(assetSymbol);
baseLTVA.push(baseLTVAsCollateral);
liquidationThresholds.push(liquidationThreshold);
liquidationBonuses.push(liquidationBonus);
reserveFactors.push(reserveFactor);
stableRatesEnabled.push(stableBorrowRateEnabled);
} }
if (tokens.length) { if (tokens.length) {
// Set aTokenAndRatesDeployer as temporal admin // Set aTokenAndRatesDeployer as temporal admin