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