mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
🐛 check pool while initializing
This commit is contained in:
parent
5ba3cc8b94
commit
66916dd5cd
|
@ -42,16 +42,18 @@ export const getFirstSigner = async () => (await getEthersSigners())[0];
|
||||||
export const getLendingPoolAddressesProvider = async (address?: tEthereumAddress) => {
|
export const getLendingPoolAddressesProvider = async (address?: tEthereumAddress) => {
|
||||||
return await LendingPoolAddressesProviderFactory.connect(
|
return await LendingPoolAddressesProviderFactory.connect(
|
||||||
address ||
|
address ||
|
||||||
(await getDb().get(`${eContractid.LendingPoolAddressesProvider}.${DRE.network.name}`).value())
|
(
|
||||||
.address,
|
await getDb().get(`${eContractid.LendingPoolAddressesProvider}.${DRE.network.name}`).value()
|
||||||
|
).address,
|
||||||
await getFirstSigner()
|
await getFirstSigner()
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export const getLendingPoolConfiguratorProxy = async (address?: tEthereumAddress) => {
|
export const getLendingPoolConfiguratorProxy = async (address?: tEthereumAddress) => {
|
||||||
return await LendingPoolConfiguratorFactory.connect(
|
return await LendingPoolConfiguratorFactory.connect(
|
||||||
address ||
|
address ||
|
||||||
(await getDb().get(`${eContractid.LendingPoolConfigurator}.${DRE.network.name}`).value())
|
(
|
||||||
.address,
|
await getDb().get(`${eContractid.LendingPoolConfigurator}.${DRE.network.name}`).value()
|
||||||
|
).address,
|
||||||
await getFirstSigner()
|
await getFirstSigner()
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -59,14 +61,18 @@ export const getLendingPoolConfiguratorProxy = async (address?: tEthereumAddress
|
||||||
export const getLendingPool = async (address?: tEthereumAddress) =>
|
export const getLendingPool = async (address?: tEthereumAddress) =>
|
||||||
await LendingPoolFactory.connect(
|
await LendingPoolFactory.connect(
|
||||||
address ||
|
address ||
|
||||||
(await getDb().get(`${eContractid.LendingPool}.${DRE.network.name}`).value()).address,
|
(
|
||||||
|
await getDb().get(`${eContractid.LendingPool}.${DRE.network.name}`).value()
|
||||||
|
).address,
|
||||||
await getFirstSigner()
|
await getFirstSigner()
|
||||||
);
|
);
|
||||||
|
|
||||||
export const getPriceOracle = async (address?: tEthereumAddress) =>
|
export const getPriceOracle = async (address?: tEthereumAddress) =>
|
||||||
await PriceOracleFactory.connect(
|
await PriceOracleFactory.connect(
|
||||||
address ||
|
address ||
|
||||||
(await getDb().get(`${eContractid.PriceOracle}.${DRE.network.name}`).value()).address,
|
(
|
||||||
|
await getDb().get(`${eContractid.PriceOracle}.${DRE.network.name}`).value()
|
||||||
|
).address,
|
||||||
await getFirstSigner()
|
await getFirstSigner()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -79,36 +85,45 @@ export const getAToken = async (address?: tEthereumAddress) =>
|
||||||
export const getStableDebtToken = async (address?: tEthereumAddress) =>
|
export const getStableDebtToken = async (address?: tEthereumAddress) =>
|
||||||
await StableDebtTokenFactory.connect(
|
await StableDebtTokenFactory.connect(
|
||||||
address ||
|
address ||
|
||||||
(await getDb().get(`${eContractid.StableDebtToken}.${DRE.network.name}`).value()).address,
|
(
|
||||||
|
await getDb().get(`${eContractid.StableDebtToken}.${DRE.network.name}`).value()
|
||||||
|
).address,
|
||||||
await getFirstSigner()
|
await getFirstSigner()
|
||||||
);
|
);
|
||||||
|
|
||||||
export const getVariableDebtToken = async (address?: tEthereumAddress) =>
|
export const getVariableDebtToken = async (address?: tEthereumAddress) =>
|
||||||
await VariableDebtTokenFactory.connect(
|
await VariableDebtTokenFactory.connect(
|
||||||
address ||
|
address ||
|
||||||
(await getDb().get(`${eContractid.VariableDebtToken}.${DRE.network.name}`).value()).address,
|
(
|
||||||
|
await getDb().get(`${eContractid.VariableDebtToken}.${DRE.network.name}`).value()
|
||||||
|
).address,
|
||||||
await getFirstSigner()
|
await getFirstSigner()
|
||||||
);
|
);
|
||||||
|
|
||||||
export const getMintableERC20 = async (address: tEthereumAddress) =>
|
export const getMintableERC20 = async (address: tEthereumAddress) =>
|
||||||
await MintableERC20Factory.connect(
|
await MintableERC20Factory.connect(
|
||||||
address ||
|
address ||
|
||||||
(await getDb().get(`${eContractid.MintableERC20}.${DRE.network.name}`).value()).address,
|
(
|
||||||
|
await getDb().get(`${eContractid.MintableERC20}.${DRE.network.name}`).value()
|
||||||
|
).address,
|
||||||
await getFirstSigner()
|
await getFirstSigner()
|
||||||
);
|
);
|
||||||
|
|
||||||
export const getIErc20Detailed = async (address: tEthereumAddress) =>
|
export const getIErc20Detailed = async (address: tEthereumAddress) =>
|
||||||
await IERC20DetailedFactory.connect(
|
await IERC20DetailedFactory.connect(
|
||||||
address ||
|
address ||
|
||||||
(await getDb().get(`${eContractid.IERC20Detailed}.${DRE.network.name}`).value()).address,
|
(
|
||||||
|
await getDb().get(`${eContractid.IERC20Detailed}.${DRE.network.name}`).value()
|
||||||
|
).address,
|
||||||
await getFirstSigner()
|
await getFirstSigner()
|
||||||
);
|
);
|
||||||
|
|
||||||
export const getAaveProtocolDataProvider = async (address?: tEthereumAddress) =>
|
export const getAaveProtocolDataProvider = async (address?: tEthereumAddress) =>
|
||||||
await AaveProtocolDataProviderFactory.connect(
|
await AaveProtocolDataProviderFactory.connect(
|
||||||
address ||
|
address ||
|
||||||
(await getDb().get(`${eContractid.AaveProtocolDataProvider}.${DRE.network.name}`).value())
|
(
|
||||||
.address,
|
await getDb().get(`${eContractid.AaveProtocolDataProvider}.${DRE.network.name}`).value()
|
||||||
|
).address,
|
||||||
await getFirstSigner()
|
await getFirstSigner()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -126,15 +141,18 @@ export const getInterestRateStrategy = async (address?: tEthereumAddress) =>
|
||||||
export const getMockFlashLoanReceiver = async (address?: tEthereumAddress) =>
|
export const getMockFlashLoanReceiver = async (address?: tEthereumAddress) =>
|
||||||
await MockFlashLoanReceiverFactory.connect(
|
await MockFlashLoanReceiverFactory.connect(
|
||||||
address ||
|
address ||
|
||||||
(await getDb().get(`${eContractid.MockFlashLoanReceiver}.${DRE.network.name}`).value())
|
(
|
||||||
.address,
|
await getDb().get(`${eContractid.MockFlashLoanReceiver}.${DRE.network.name}`).value()
|
||||||
|
).address,
|
||||||
await getFirstSigner()
|
await getFirstSigner()
|
||||||
);
|
);
|
||||||
|
|
||||||
export const getLendingRateOracle = async (address?: tEthereumAddress) =>
|
export const getLendingRateOracle = async (address?: tEthereumAddress) =>
|
||||||
await LendingRateOracleFactory.connect(
|
await LendingRateOracleFactory.connect(
|
||||||
address ||
|
address ||
|
||||||
(await getDb().get(`${eContractid.LendingRateOracle}.${DRE.network.name}`).value()).address,
|
(
|
||||||
|
await getDb().get(`${eContractid.LendingRateOracle}.${DRE.network.name}`).value()
|
||||||
|
).address,
|
||||||
await getFirstSigner()
|
await getFirstSigner()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -180,10 +198,9 @@ export const getPairsTokenAggregator = (
|
||||||
const aggregatorAddressIndex = Object.keys(aggregatorsAddresses).findIndex(
|
const aggregatorAddressIndex = Object.keys(aggregatorsAddresses).findIndex(
|
||||||
(value) => value === tokenSymbol
|
(value) => value === tokenSymbol
|
||||||
);
|
);
|
||||||
const [, aggregatorAddress] = (Object.entries(aggregatorsAddresses) as [
|
const [, aggregatorAddress] = (
|
||||||
string,
|
Object.entries(aggregatorsAddresses) as [string, tEthereumAddress][]
|
||||||
tEthereumAddress
|
)[aggregatorAddressIndex];
|
||||||
][])[aggregatorAddressIndex];
|
|
||||||
return [tokenAddress, aggregatorAddress];
|
return [tokenAddress, aggregatorAddress];
|
||||||
//}
|
//}
|
||||||
}) as [string, string][];
|
}) as [string, string][];
|
||||||
|
@ -209,14 +226,18 @@ export const getLendingPoolAddressesProviderRegistry = async (address?: tEthereu
|
||||||
export const getReserveLogic = async (address?: tEthereumAddress) =>
|
export const getReserveLogic = async (address?: tEthereumAddress) =>
|
||||||
await ReserveLogicFactory.connect(
|
await ReserveLogicFactory.connect(
|
||||||
address ||
|
address ||
|
||||||
(await getDb().get(`${eContractid.ReserveLogic}.${DRE.network.name}`).value()).address,
|
(
|
||||||
|
await getDb().get(`${eContractid.ReserveLogic}.${DRE.network.name}`).value()
|
||||||
|
).address,
|
||||||
await getFirstSigner()
|
await getFirstSigner()
|
||||||
);
|
);
|
||||||
|
|
||||||
export const getGenericLogic = async (address?: tEthereumAddress) =>
|
export const getGenericLogic = async (address?: tEthereumAddress) =>
|
||||||
await GenericLogicFactory.connect(
|
await GenericLogicFactory.connect(
|
||||||
address ||
|
address ||
|
||||||
(await getDb().get(`${eContractid.GenericLogic}.${DRE.network.name}`).value()).address,
|
(
|
||||||
|
await getDb().get(`${eContractid.GenericLogic}.${DRE.network.name}`).value()
|
||||||
|
).address,
|
||||||
await getFirstSigner()
|
await getFirstSigner()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -234,15 +255,27 @@ export const getStableAndVariableTokensHelper = async (address?: tEthereumAddres
|
||||||
export const getATokensAndRatesHelper = async (address?: tEthereumAddress) =>
|
export const getATokensAndRatesHelper = async (address?: tEthereumAddress) =>
|
||||||
await ATokensAndRatesHelperFactory.connect(
|
await ATokensAndRatesHelperFactory.connect(
|
||||||
address ||
|
address ||
|
||||||
(await getDb().get(`${eContractid.ATokensAndRatesHelper}.${DRE.network.name}`).value())
|
(
|
||||||
.address,
|
await getDb().get(`${eContractid.ATokensAndRatesHelper}.${DRE.network.name}`).value()
|
||||||
|
).address,
|
||||||
await getFirstSigner()
|
await getFirstSigner()
|
||||||
);
|
);
|
||||||
|
|
||||||
export const getWETHGateway = async (address?: tEthereumAddress) =>
|
export const getWETHGateway = async (address?: tEthereumAddress) =>
|
||||||
await WETHGatewayFactory.connect(
|
await WETHGatewayFactory.connect(
|
||||||
address ||
|
address ||
|
||||||
(await getDb().get(`${eContractid.WETHGateway}.${DRE.network.name}`).value()).address,
|
(
|
||||||
|
await getDb().get(`${eContractid.WETHGateway}.${DRE.network.name}`).value()
|
||||||
|
).address,
|
||||||
|
await getFirstSigner()
|
||||||
|
);
|
||||||
|
|
||||||
|
export const getPermissionedWETHGateway = async (address?: tEthereumAddress) =>
|
||||||
|
await WETHGatewayFactory.connect(
|
||||||
|
address ||
|
||||||
|
(
|
||||||
|
await getDb().get(`${eContractid.PermissionedWETHGateway}.${DRE.network.name}`).value()
|
||||||
|
).address,
|
||||||
await getFirstSigner()
|
await getFirstSigner()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -261,23 +294,27 @@ export const getMockAToken = async (address?: tEthereumAddress) =>
|
||||||
export const getMockVariableDebtToken = async (address?: tEthereumAddress) =>
|
export const getMockVariableDebtToken = async (address?: tEthereumAddress) =>
|
||||||
await MockVariableDebtTokenFactory.connect(
|
await MockVariableDebtTokenFactory.connect(
|
||||||
address ||
|
address ||
|
||||||
(await getDb().get(`${eContractid.MockVariableDebtToken}.${DRE.network.name}`).value())
|
(
|
||||||
.address,
|
await getDb().get(`${eContractid.MockVariableDebtToken}.${DRE.network.name}`).value()
|
||||||
|
).address,
|
||||||
await getFirstSigner()
|
await getFirstSigner()
|
||||||
);
|
);
|
||||||
|
|
||||||
export const getMockStableDebtToken = async (address?: tEthereumAddress) =>
|
export const getMockStableDebtToken = async (address?: tEthereumAddress) =>
|
||||||
await MockStableDebtTokenFactory.connect(
|
await MockStableDebtTokenFactory.connect(
|
||||||
address ||
|
address ||
|
||||||
(await getDb().get(`${eContractid.MockStableDebtToken}.${DRE.network.name}`).value()).address,
|
(
|
||||||
|
await getDb().get(`${eContractid.MockStableDebtToken}.${DRE.network.name}`).value()
|
||||||
|
).address,
|
||||||
await getFirstSigner()
|
await getFirstSigner()
|
||||||
);
|
);
|
||||||
|
|
||||||
export const getSelfdestructTransferMock = async (address?: tEthereumAddress) =>
|
export const getSelfdestructTransferMock = async (address?: tEthereumAddress) =>
|
||||||
await SelfdestructTransferFactory.connect(
|
await SelfdestructTransferFactory.connect(
|
||||||
address ||
|
address ||
|
||||||
(await getDb().get(`${eContractid.SelfdestructTransferMock}.${DRE.network.name}`).value())
|
(
|
||||||
.address,
|
await getDb().get(`${eContractid.SelfdestructTransferMock}.${DRE.network.name}`).value()
|
||||||
|
).address,
|
||||||
await getFirstSigner()
|
await getFirstSigner()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -287,15 +324,18 @@ export const getProxy = async (address: tEthereumAddress) =>
|
||||||
export const getLendingPoolImpl = async (address?: tEthereumAddress) =>
|
export const getLendingPoolImpl = async (address?: tEthereumAddress) =>
|
||||||
await LendingPoolFactory.connect(
|
await LendingPoolFactory.connect(
|
||||||
address ||
|
address ||
|
||||||
(await getDb().get(`${eContractid.LendingPoolImpl}.${DRE.network.name}`).value()).address,
|
(
|
||||||
|
await getDb().get(`${eContractid.LendingPoolImpl}.${DRE.network.name}`).value()
|
||||||
|
).address,
|
||||||
await getFirstSigner()
|
await getFirstSigner()
|
||||||
);
|
);
|
||||||
|
|
||||||
export const getLendingPoolConfiguratorImpl = async (address?: tEthereumAddress) =>
|
export const getLendingPoolConfiguratorImpl = async (address?: tEthereumAddress) =>
|
||||||
await LendingPoolConfiguratorFactory.connect(
|
await LendingPoolConfiguratorFactory.connect(
|
||||||
address ||
|
address ||
|
||||||
(await getDb().get(`${eContractid.LendingPoolConfiguratorImpl}.${DRE.network.name}`).value())
|
(
|
||||||
.address,
|
await getDb().get(`${eContractid.LendingPoolConfiguratorImpl}.${DRE.network.name}`).value()
|
||||||
|
).address,
|
||||||
await getFirstSigner()
|
await getFirstSigner()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -313,16 +353,18 @@ export const getLendingPoolCollateralManagerImpl = async (address?: tEthereumAdd
|
||||||
export const getWalletProvider = async (address?: tEthereumAddress) =>
|
export const getWalletProvider = async (address?: tEthereumAddress) =>
|
||||||
await WalletBalanceProviderFactory.connect(
|
await WalletBalanceProviderFactory.connect(
|
||||||
address ||
|
address ||
|
||||||
(await getDb().get(`${eContractid.WalletBalanceProvider}.${DRE.network.name}`).value())
|
(
|
||||||
.address,
|
await getDb().get(`${eContractid.WalletBalanceProvider}.${DRE.network.name}`).value()
|
||||||
|
).address,
|
||||||
await getFirstSigner()
|
await getFirstSigner()
|
||||||
);
|
);
|
||||||
|
|
||||||
export const getLendingPoolCollateralManager = async (address?: tEthereumAddress) =>
|
export const getLendingPoolCollateralManager = async (address?: tEthereumAddress) =>
|
||||||
await LendingPoolCollateralManagerFactory.connect(
|
await LendingPoolCollateralManagerFactory.connect(
|
||||||
address ||
|
address ||
|
||||||
(await getDb().get(`${eContractid.LendingPoolCollateralManager}.${DRE.network.name}`).value())
|
(
|
||||||
.address,
|
await getDb().get(`${eContractid.LendingPoolCollateralManager}.${DRE.network.name}`).value()
|
||||||
|
).address,
|
||||||
await getFirstSigner()
|
await getFirstSigner()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -338,38 +380,44 @@ export const getAaveOracle = async (address?: tEthereumAddress) =>
|
||||||
export const getMockUniswapRouter = async (address?: tEthereumAddress) =>
|
export const getMockUniswapRouter = async (address?: tEthereumAddress) =>
|
||||||
await MockUniswapV2Router02Factory.connect(
|
await MockUniswapV2Router02Factory.connect(
|
||||||
address ||
|
address ||
|
||||||
(await getDb().get(`${eContractid.MockUniswapV2Router02}.${DRE.network.name}`).value())
|
(
|
||||||
.address,
|
await getDb().get(`${eContractid.MockUniswapV2Router02}.${DRE.network.name}`).value()
|
||||||
|
).address,
|
||||||
await getFirstSigner()
|
await getFirstSigner()
|
||||||
);
|
);
|
||||||
|
|
||||||
export const getUniswapLiquiditySwapAdapter = async (address?: tEthereumAddress) =>
|
export const getUniswapLiquiditySwapAdapter = async (address?: tEthereumAddress) =>
|
||||||
await UniswapLiquiditySwapAdapterFactory.connect(
|
await UniswapLiquiditySwapAdapterFactory.connect(
|
||||||
address ||
|
address ||
|
||||||
(await getDb().get(`${eContractid.UniswapLiquiditySwapAdapter}.${DRE.network.name}`).value())
|
(
|
||||||
.address,
|
await getDb().get(`${eContractid.UniswapLiquiditySwapAdapter}.${DRE.network.name}`).value()
|
||||||
|
).address,
|
||||||
await getFirstSigner()
|
await getFirstSigner()
|
||||||
);
|
);
|
||||||
|
|
||||||
export const getUniswapRepayAdapter = async (address?: tEthereumAddress) =>
|
export const getUniswapRepayAdapter = async (address?: tEthereumAddress) =>
|
||||||
await UniswapRepayAdapterFactory.connect(
|
await UniswapRepayAdapterFactory.connect(
|
||||||
address ||
|
address ||
|
||||||
(await getDb().get(`${eContractid.UniswapRepayAdapter}.${DRE.network.name}`).value()).address,
|
(
|
||||||
|
await getDb().get(`${eContractid.UniswapRepayAdapter}.${DRE.network.name}`).value()
|
||||||
|
).address,
|
||||||
await getFirstSigner()
|
await getFirstSigner()
|
||||||
);
|
);
|
||||||
|
|
||||||
export const getFlashLiquidationAdapter = async (address?: tEthereumAddress) =>
|
export const getFlashLiquidationAdapter = async (address?: tEthereumAddress) =>
|
||||||
await FlashLiquidationAdapterFactory.connect(
|
await FlashLiquidationAdapterFactory.connect(
|
||||||
address ||
|
address ||
|
||||||
(await getDb().get(`${eContractid.FlashLiquidationAdapter}.${DRE.network.name}`).value())
|
(
|
||||||
.address,
|
await getDb().get(`${eContractid.FlashLiquidationAdapter}.${DRE.network.name}`).value()
|
||||||
|
).address,
|
||||||
await getFirstSigner()
|
await getFirstSigner()
|
||||||
);
|
);
|
||||||
|
|
||||||
export const getPermissionManager = async (address?: tEthereumAddress) =>
|
export const getPermissionManager = async (address?: tEthereumAddress) =>
|
||||||
await PermissionManagerFactory.connect(
|
await PermissionManagerFactory.connect(
|
||||||
address ||
|
address ||
|
||||||
(await getDb().get(`${eContractid.PermissionManager}.${DRE.network.name}`).value()).address,
|
(
|
||||||
|
await getDb().get(`${eContractid.PermissionManager}.${DRE.network.name}`).value()
|
||||||
|
).address,
|
||||||
await getFirstSigner()
|
await getFirstSigner()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ import {
|
||||||
getWethAddress,
|
getWethAddress,
|
||||||
getTreasuryAddress,
|
getTreasuryAddress,
|
||||||
} from '../../helpers/configuration';
|
} from '../../helpers/configuration';
|
||||||
import { getWETHGateway } from '../../helpers/contracts-getters';
|
import { getPermissionedWETHGateway, getWETHGateway } from '../../helpers/contracts-getters';
|
||||||
import { eNetwork, ICommonConfiguration } from '../../helpers/types';
|
import { eNetwork, ICommonConfiguration } from '../../helpers/types';
|
||||||
import { notFalsyOrZeroAddress, waitForTx } from '../../helpers/misc-utils';
|
import { notFalsyOrZeroAddress, waitForTx } from '../../helpers/misc-utils';
|
||||||
import { initReservesByHelper, configureReservesByHelper } from '../../helpers/init-helpers';
|
import { initReservesByHelper, configureReservesByHelper } from '../../helpers/init-helpers';
|
||||||
|
@ -106,8 +106,12 @@ task('full:initialize-lending-pool', 'Initialize lending pool configuration.')
|
||||||
|
|
||||||
let gateWay = getParamPerNetwork(WethGateway, network);
|
let gateWay = getParamPerNetwork(WethGateway, network);
|
||||||
if (!notFalsyOrZeroAddress(gateWay)) {
|
if (!notFalsyOrZeroAddress(gateWay)) {
|
||||||
|
if (pool === ConfigNames.AavePro) {
|
||||||
|
gateWay = (await getPermissionedWETHGateway()).address;
|
||||||
|
} else {
|
||||||
gateWay = (await getWETHGateway()).address;
|
gateWay = (await getWETHGateway()).address;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
console.log('GATEWAY', gateWay);
|
console.log('GATEWAY', gateWay);
|
||||||
await authorizeWETHGateway(gateWay, lendingPoolAddress);
|
await authorizeWETHGateway(gateWay, lendingPoolAddress);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user