Added waitForTx to missing methods.

This commit is contained in:
David Racero 2020-10-21 11:42:27 +02:00
parent 7ddf18b823
commit 4ee41dbece
3 changed files with 26 additions and 16 deletions

View File

@ -1,6 +1,6 @@
import {Contract, Signer, utils, ethers} from 'ethers';
import {CommonsConfig} from '../config/commons';
import {getDb, BRE} from './misc-utils';
import {getDb, BRE, waitForTx} from './misc-utils';
import {
tEthereumAddress,
eContractid,
@ -101,7 +101,7 @@ export const deployContract = async <ContractType extends Contract>(
const contract = (await (await BRE.ethers.getContractFactory(contractName)).deploy(
...args
)) as ContractType;
await waitForTx(contract.deployTransaction);
await registerContractInJsonDb(<eContractid>contractName, contract);
return contract;
};
@ -856,13 +856,15 @@ export const initReserves = async (
}
console.log('init reserve currency ', assetSymbol);
await lendingPoolConfigurator.initReserve(
tokenAddress,
aToken.address,
stableDebtToken.address,
variableDebtToken.address,
reserveDecimals,
rateStrategyContract.address
await waitForTx(
await lendingPoolConfigurator.initReserve(
tokenAddress,
aToken.address,
stableDebtToken.address,
variableDebtToken.address,
reserveDecimals,
rateStrategyContract.address
)
);
} catch (e) {
console.log(`Reserve initialization for ${assetSymbol} failed with error ${e}. Skipped.`);

View File

@ -2,6 +2,7 @@ import {iMultiPoolsAssets, IReserveParams, tEthereumAddress} from './types';
import {LendingPool} from '../types/LendingPool';
import {LendingPoolConfigurator} from '../types/LendingPoolConfigurator';
import {AaveProtocolTestHelpers} from '../types/AaveProtocolTestHelpers';
import {waitForTx} from './misc-utils';
export const enableReservesToBorrow = async (
reservesParams: iMultiPoolsAssets<IReserveParams>,
@ -29,7 +30,12 @@ export const enableReservesToBorrow = async (
continue;
}
await lendingPoolConfigurator.enableBorrowingOnReserve(tokenAddress, stableBorrowRateEnabled);
await waitForTx(
await lendingPoolConfigurator.enableBorrowingOnReserve(
tokenAddress,
stableBorrowRateEnabled
)
);
} catch (e) {
console.log(
`Enabling reserve for borrowings for ${assetSymbol} failed with error ${e}. Skipped.`
@ -66,11 +72,13 @@ export const enableReservesAsCollateral = async (
}
try {
await lendingPoolConfigurator.enableReserveAsCollateral(
tokenAddress,
baseLTVAsCollateral,
liquidationThreshold,
liquidationBonus
await waitForTx(
await lendingPoolConfigurator.enableReserveAsCollateral(
tokenAddress,
baseLTVAsCollateral,
liquidationThreshold,
liquidationBonus
)
);
} catch (e) {
console.log(

View File

@ -30,7 +30,7 @@ export const setInitialMarketRatesInRatesOracle = async (
const [, assetAddress] = (Object.entries(assetsAddresses) as [string, string][])[
assetAddressIndex
];
await lendingRateOracleInstance.setMarketBorrowRate(assetAddress, borrowRate);
await waitForTx(await lendingRateOracleInstance.setMarketBorrowRate(assetAddress, borrowRate));
console.log('added Market Borrow Rate for: ', assetSymbol);
}
};