2020-10-15 11:57:03 +00:00
|
|
|
import {
|
2020-11-10 14:19:47 +00:00
|
|
|
AaveProtocolDataProviderFactory,
|
2020-10-15 11:57:03 +00:00
|
|
|
ATokenFactory,
|
2020-10-27 09:58:51 +00:00
|
|
|
ATokensAndRatesHelperFactory,
|
2020-11-17 09:24:24 +00:00
|
|
|
AaveOracleFactory,
|
2020-10-15 11:57:03 +00:00
|
|
|
DefaultReserveInterestRateStrategyFactory,
|
2020-10-15 17:19:02 +00:00
|
|
|
GenericLogicFactory,
|
2020-11-10 12:11:33 +00:00
|
|
|
InitializableAdminUpgradeabilityProxyFactory,
|
2020-10-15 11:57:03 +00:00
|
|
|
LendingPoolAddressesProviderFactory,
|
|
|
|
LendingPoolAddressesProviderRegistryFactory,
|
2020-11-10 12:11:33 +00:00
|
|
|
LendingPoolCollateralManagerFactory,
|
2020-10-15 11:57:03 +00:00
|
|
|
LendingPoolConfiguratorFactory,
|
|
|
|
LendingPoolFactory,
|
|
|
|
LendingRateOracleFactory,
|
2020-11-18 18:18:02 +00:00
|
|
|
MintableERC20Factory,
|
2020-10-30 12:40:06 +00:00
|
|
|
MockATokenFactory,
|
2020-10-15 11:57:03 +00:00
|
|
|
MockFlashLoanReceiverFactory,
|
2020-10-30 12:40:06 +00:00
|
|
|
MockStableDebtTokenFactory,
|
|
|
|
MockVariableDebtTokenFactory,
|
2020-10-29 20:29:41 +00:00
|
|
|
MockUniswapV2Router02Factory,
|
2021-03-18 15:44:52 +00:00
|
|
|
MockParaSwapAugustusFactory,
|
2021-05-20 22:25:51 +00:00
|
|
|
MockParaSwapAugustusRegistryFactory,
|
2021-03-18 15:44:52 +00:00
|
|
|
ParaSwapLiquiditySwapAdapterFactory,
|
2020-10-15 11:57:03 +00:00
|
|
|
PriceOracleFactory,
|
2020-10-15 17:19:02 +00:00
|
|
|
ReserveLogicFactory,
|
2020-11-03 16:23:35 +00:00
|
|
|
SelfdestructTransferFactory,
|
2020-10-27 09:58:51 +00:00
|
|
|
StableAndVariableTokensHelperFactory,
|
2020-10-15 11:57:03 +00:00
|
|
|
StableDebtTokenFactory,
|
2020-10-29 20:29:41 +00:00
|
|
|
UniswapLiquiditySwapAdapterFactory,
|
|
|
|
UniswapRepayAdapterFactory,
|
2020-10-15 11:57:03 +00:00
|
|
|
VariableDebtTokenFactory,
|
2020-11-10 12:11:33 +00:00
|
|
|
WalletBalanceProviderFactory,
|
2020-11-18 18:18:02 +00:00
|
|
|
WETH9MockedFactory,
|
|
|
|
WETHGatewayFactory,
|
2021-01-15 15:48:54 +00:00
|
|
|
FlashLiquidationAdapterFactory,
|
2020-10-15 11:57:03 +00:00
|
|
|
} from '../types';
|
2020-11-18 18:18:02 +00:00
|
|
|
import { IERC20DetailedFactory } from '../types/IERC20DetailedFactory';
|
2021-05-17 12:35:21 +00:00
|
|
|
import { getEthersSigners, MockTokenMap } from './contracts-helpers';
|
2021-07-14 14:41:32 +00:00
|
|
|
import { DRE, getDb, notFalsyOrZeroAddress, omit } from './misc-utils';
|
2020-11-18 18:18:02 +00:00
|
|
|
import { eContractid, PoolConfiguration, tEthereumAddress, TokenContractId } from './types';
|
2020-10-15 11:57:03 +00:00
|
|
|
|
2021-05-17 12:35:21 +00:00
|
|
|
export const getFirstSigner = async () => (await getEthersSigners())[0];
|
2020-10-15 17:19:02 +00:00
|
|
|
|
2021-03-11 15:55:04 +00:00
|
|
|
export const getLendingPoolAddressesProvider = async (address?: tEthereumAddress) => {
|
|
|
|
return await LendingPoolAddressesProviderFactory.connect(
|
2020-10-15 11:57:03 +00:00
|
|
|
address ||
|
2021-07-14 14:41:32 +00:00
|
|
|
(
|
|
|
|
await getDb().get(`${eContractid.LendingPoolAddressesProvider}.${DRE.network.name}`).value()
|
|
|
|
).address,
|
2020-10-15 17:19:02 +00:00
|
|
|
await getFirstSigner()
|
2020-10-15 11:57:03 +00:00
|
|
|
);
|
2021-03-11 15:55:04 +00:00
|
|
|
};
|
2020-10-15 11:57:03 +00:00
|
|
|
export const getLendingPoolConfiguratorProxy = async (address?: tEthereumAddress) => {
|
|
|
|
return await LendingPoolConfiguratorFactory.connect(
|
|
|
|
address ||
|
2021-07-14 14:41:32 +00:00
|
|
|
(
|
|
|
|
await getDb().get(`${eContractid.LendingPoolConfigurator}.${DRE.network.name}`).value()
|
|
|
|
).address,
|
2020-10-15 17:19:02 +00:00
|
|
|
await getFirstSigner()
|
2020-10-15 11:57:03 +00:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export const getLendingPool = async (address?: tEthereumAddress) =>
|
|
|
|
await LendingPoolFactory.connect(
|
|
|
|
address ||
|
2021-07-14 14:41:32 +00:00
|
|
|
(
|
|
|
|
await getDb().get(`${eContractid.LendingPool}.${DRE.network.name}`).value()
|
|
|
|
).address,
|
2020-10-15 17:19:02 +00:00
|
|
|
await getFirstSigner()
|
2020-10-15 11:57:03 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
export const getPriceOracle = async (address?: tEthereumAddress) =>
|
|
|
|
await PriceOracleFactory.connect(
|
|
|
|
address ||
|
2021-07-14 14:41:32 +00:00
|
|
|
(
|
|
|
|
await getDb().get(`${eContractid.PriceOracle}.${DRE.network.name}`).value()
|
|
|
|
).address,
|
2020-10-15 17:19:02 +00:00
|
|
|
await getFirstSigner()
|
2020-10-15 11:57:03 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
export const getAToken = async (address?: tEthereumAddress) =>
|
|
|
|
await ATokenFactory.connect(
|
2020-11-05 12:44:20 +00:00
|
|
|
address || (await getDb().get(`${eContractid.AToken}.${DRE.network.name}`).value()).address,
|
2020-10-15 17:19:02 +00:00
|
|
|
await getFirstSigner()
|
2020-10-15 11:57:03 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
export const getStableDebtToken = async (address?: tEthereumAddress) =>
|
|
|
|
await StableDebtTokenFactory.connect(
|
|
|
|
address ||
|
2021-07-14 14:41:32 +00:00
|
|
|
(
|
|
|
|
await getDb().get(`${eContractid.StableDebtToken}.${DRE.network.name}`).value()
|
|
|
|
).address,
|
2020-10-15 17:19:02 +00:00
|
|
|
await getFirstSigner()
|
2020-10-15 11:57:03 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
export const getVariableDebtToken = async (address?: tEthereumAddress) =>
|
|
|
|
await VariableDebtTokenFactory.connect(
|
|
|
|
address ||
|
2021-07-14 14:41:32 +00:00
|
|
|
(
|
|
|
|
await getDb().get(`${eContractid.VariableDebtToken}.${DRE.network.name}`).value()
|
|
|
|
).address,
|
2020-10-15 17:19:02 +00:00
|
|
|
await getFirstSigner()
|
2020-10-15 11:57:03 +00:00
|
|
|
);
|
|
|
|
|
2020-11-18 18:18:02 +00:00
|
|
|
export const getMintableERC20 = async (address: tEthereumAddress) =>
|
|
|
|
await MintableERC20Factory.connect(
|
2020-10-15 11:57:03 +00:00
|
|
|
address ||
|
2021-07-14 14:41:32 +00:00
|
|
|
(
|
|
|
|
await getDb().get(`${eContractid.MintableERC20}.${DRE.network.name}`).value()
|
|
|
|
).address,
|
2020-10-15 17:19:02 +00:00
|
|
|
await getFirstSigner()
|
2020-10-15 11:57:03 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
export const getIErc20Detailed = async (address: tEthereumAddress) =>
|
2020-11-18 18:18:02 +00:00
|
|
|
await IERC20DetailedFactory.connect(
|
2020-10-15 11:57:03 +00:00
|
|
|
address ||
|
2021-07-14 14:41:32 +00:00
|
|
|
(
|
|
|
|
await getDb().get(`${eContractid.IERC20Detailed}.${DRE.network.name}`).value()
|
|
|
|
).address,
|
2020-10-15 17:19:02 +00:00
|
|
|
await getFirstSigner()
|
2020-10-15 11:57:03 +00:00
|
|
|
);
|
|
|
|
|
2020-11-10 14:19:47 +00:00
|
|
|
export const getAaveProtocolDataProvider = async (address?: tEthereumAddress) =>
|
|
|
|
await AaveProtocolDataProviderFactory.connect(
|
2020-10-15 11:57:03 +00:00
|
|
|
address ||
|
2021-07-14 14:41:32 +00:00
|
|
|
(
|
|
|
|
await getDb().get(`${eContractid.AaveProtocolDataProvider}.${DRE.network.name}`).value()
|
|
|
|
).address,
|
2020-10-15 17:19:02 +00:00
|
|
|
await getFirstSigner()
|
2020-10-15 11:57:03 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
export const getInterestRateStrategy = async (address?: tEthereumAddress) =>
|
|
|
|
await DefaultReserveInterestRateStrategyFactory.connect(
|
|
|
|
address ||
|
|
|
|
(
|
|
|
|
await getDb()
|
2020-11-05 12:44:20 +00:00
|
|
|
.get(`${eContractid.DefaultReserveInterestRateStrategy}.${DRE.network.name}`)
|
2020-10-15 11:57:03 +00:00
|
|
|
.value()
|
|
|
|
).address,
|
2020-10-15 17:19:02 +00:00
|
|
|
await getFirstSigner()
|
2020-10-15 11:57:03 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
export const getMockFlashLoanReceiver = async (address?: tEthereumAddress) =>
|
|
|
|
await MockFlashLoanReceiverFactory.connect(
|
|
|
|
address ||
|
2021-07-14 14:41:32 +00:00
|
|
|
(
|
|
|
|
await getDb().get(`${eContractid.MockFlashLoanReceiver}.${DRE.network.name}`).value()
|
|
|
|
).address,
|
2020-10-15 17:19:02 +00:00
|
|
|
await getFirstSigner()
|
2020-10-15 11:57:03 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
export const getLendingRateOracle = async (address?: tEthereumAddress) =>
|
|
|
|
await LendingRateOracleFactory.connect(
|
|
|
|
address ||
|
2021-07-14 14:41:32 +00:00
|
|
|
(
|
|
|
|
await getDb().get(`${eContractid.LendingRateOracle}.${DRE.network.name}`).value()
|
|
|
|
).address,
|
2020-10-15 17:19:02 +00:00
|
|
|
await getFirstSigner()
|
2020-10-15 11:57:03 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
export const getMockedTokens = async (config: PoolConfiguration) => {
|
2020-11-04 10:47:06 +00:00
|
|
|
const tokenSymbols = Object.keys(config.ReservesConfig);
|
2020-10-15 11:57:03 +00:00
|
|
|
const db = getDb();
|
|
|
|
const tokens: MockTokenMap = await tokenSymbols.reduce<Promise<MockTokenMap>>(
|
|
|
|
async (acc, tokenSymbol) => {
|
|
|
|
const accumulator = await acc;
|
2020-11-05 12:44:20 +00:00
|
|
|
const address = db.get(`${tokenSymbol.toUpperCase()}.${DRE.network.name}`).value().address;
|
2020-11-18 18:18:02 +00:00
|
|
|
accumulator[tokenSymbol] = await getMintableERC20(address);
|
2020-10-15 11:57:03 +00:00
|
|
|
return Promise.resolve(acc);
|
|
|
|
},
|
|
|
|
Promise.resolve({})
|
|
|
|
);
|
|
|
|
return tokens;
|
|
|
|
};
|
|
|
|
|
|
|
|
export const getAllMockedTokens = async () => {
|
|
|
|
const db = getDb();
|
|
|
|
const tokens: MockTokenMap = await Object.keys(TokenContractId).reduce<Promise<MockTokenMap>>(
|
|
|
|
async (acc, tokenSymbol) => {
|
|
|
|
const accumulator = await acc;
|
2020-11-05 12:44:20 +00:00
|
|
|
const address = db.get(`${tokenSymbol.toUpperCase()}.${DRE.network.name}`).value().address;
|
2020-11-18 18:18:02 +00:00
|
|
|
accumulator[tokenSymbol] = await getMintableERC20(address);
|
2020-10-15 11:57:03 +00:00
|
|
|
return Promise.resolve(acc);
|
|
|
|
},
|
|
|
|
Promise.resolve({})
|
|
|
|
);
|
|
|
|
return tokens;
|
|
|
|
};
|
|
|
|
|
2021-07-14 14:41:32 +00:00
|
|
|
export const getQuoteCurrencies = (oracleQuoteCurrency: string): string[] => {
|
|
|
|
switch (oracleQuoteCurrency) {
|
|
|
|
case 'USD':
|
|
|
|
return ['USD'];
|
|
|
|
case 'ETH':
|
|
|
|
case 'WETH':
|
|
|
|
default:
|
|
|
|
return ['ETH', 'WETH'];
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-10-15 11:57:03 +00:00
|
|
|
export const getPairsTokenAggregator = (
|
|
|
|
allAssetsAddresses: {
|
|
|
|
[tokenSymbol: string]: tEthereumAddress;
|
|
|
|
},
|
2021-07-14 14:41:32 +00:00
|
|
|
aggregatorsAddresses: { [tokenSymbol: string]: tEthereumAddress },
|
|
|
|
oracleQuoteCurrency: string
|
2020-10-15 11:57:03 +00:00
|
|
|
): [string[], string[]] => {
|
2021-07-14 14:41:32 +00:00
|
|
|
const assetsWithoutQuoteCurrency = omit(
|
|
|
|
allAssetsAddresses,
|
|
|
|
getQuoteCurrencies(oracleQuoteCurrency)
|
|
|
|
);
|
2020-10-15 11:57:03 +00:00
|
|
|
|
2021-07-14 14:41:32 +00:00
|
|
|
const pairs = Object.entries(assetsWithoutQuoteCurrency).map(([tokenSymbol, tokenAddress]) => {
|
2021-02-08 16:24:01 +00:00
|
|
|
//if (true/*tokenSymbol !== 'WETH' && tokenSymbol !== 'ETH' && tokenSymbol !== 'LpWETH'*/) {
|
2021-01-13 06:05:44 +00:00
|
|
|
const aggregatorAddressIndex = Object.keys(aggregatorsAddresses).findIndex(
|
|
|
|
(value) => value === tokenSymbol
|
|
|
|
);
|
2021-07-14 14:41:32 +00:00
|
|
|
const [, aggregatorAddress] = (
|
|
|
|
Object.entries(aggregatorsAddresses) as [string, tEthereumAddress][]
|
|
|
|
)[aggregatorAddressIndex];
|
2021-01-13 06:05:44 +00:00
|
|
|
return [tokenAddress, aggregatorAddress];
|
|
|
|
//}
|
2020-10-15 11:57:03 +00:00
|
|
|
}) as [string, string][];
|
|
|
|
|
|
|
|
const mappedPairs = pairs.map(([asset]) => asset);
|
|
|
|
const mappedAggregators = pairs.map(([, source]) => source);
|
|
|
|
|
|
|
|
return [mappedPairs, mappedAggregators];
|
|
|
|
};
|
|
|
|
|
|
|
|
export const getLendingPoolAddressesProviderRegistry = async (address?: tEthereumAddress) =>
|
|
|
|
await LendingPoolAddressesProviderRegistryFactory.connect(
|
2021-03-26 14:20:24 +00:00
|
|
|
notFalsyOrZeroAddress(address)
|
|
|
|
? address
|
|
|
|
: (
|
|
|
|
await getDb()
|
|
|
|
.get(`${eContractid.LendingPoolAddressesProviderRegistry}.${DRE.network.name}`)
|
|
|
|
.value()
|
|
|
|
).address,
|
2020-10-15 17:19:02 +00:00
|
|
|
await getFirstSigner()
|
|
|
|
);
|
|
|
|
|
2020-10-16 09:27:09 +00:00
|
|
|
export const getReserveLogic = async (address?: tEthereumAddress) =>
|
2020-10-15 17:19:02 +00:00
|
|
|
await ReserveLogicFactory.connect(
|
|
|
|
address ||
|
2021-07-14 14:41:32 +00:00
|
|
|
(
|
|
|
|
await getDb().get(`${eContractid.ReserveLogic}.${DRE.network.name}`).value()
|
|
|
|
).address,
|
2020-10-15 17:19:02 +00:00
|
|
|
await getFirstSigner()
|
|
|
|
);
|
|
|
|
|
|
|
|
export const getGenericLogic = async (address?: tEthereumAddress) =>
|
|
|
|
await GenericLogicFactory.connect(
|
|
|
|
address ||
|
2021-07-14 14:41:32 +00:00
|
|
|
(
|
|
|
|
await getDb().get(`${eContractid.GenericLogic}.${DRE.network.name}`).value()
|
|
|
|
).address,
|
2020-10-15 17:19:02 +00:00
|
|
|
await getFirstSigner()
|
2020-10-15 11:57:03 +00:00
|
|
|
);
|
2020-10-26 16:43:10 +00:00
|
|
|
|
|
|
|
export const getStableAndVariableTokensHelper = async (address?: tEthereumAddress) =>
|
2020-10-27 09:58:51 +00:00
|
|
|
await StableAndVariableTokensHelperFactory.connect(
|
2020-10-26 16:43:10 +00:00
|
|
|
address ||
|
|
|
|
(
|
|
|
|
await getDb()
|
2020-11-05 12:44:20 +00:00
|
|
|
.get(`${eContractid.StableAndVariableTokensHelper}.${DRE.network.name}`)
|
2020-10-26 16:43:10 +00:00
|
|
|
.value()
|
|
|
|
).address,
|
|
|
|
await getFirstSigner()
|
|
|
|
);
|
|
|
|
|
|
|
|
export const getATokensAndRatesHelper = async (address?: tEthereumAddress) =>
|
2020-10-27 09:58:51 +00:00
|
|
|
await ATokensAndRatesHelperFactory.connect(
|
2020-10-26 16:43:10 +00:00
|
|
|
address ||
|
2021-07-14 14:41:32 +00:00
|
|
|
(
|
|
|
|
await getDb().get(`${eContractid.ATokensAndRatesHelper}.${DRE.network.name}`).value()
|
|
|
|
).address,
|
2020-10-26 16:43:10 +00:00
|
|
|
await getFirstSigner()
|
|
|
|
);
|
2020-10-30 12:40:06 +00:00
|
|
|
|
2020-10-28 17:06:24 +00:00
|
|
|
export const getWETHGateway = async (address?: tEthereumAddress) =>
|
2020-11-18 18:18:02 +00:00
|
|
|
await WETHGatewayFactory.connect(
|
2020-10-28 17:06:24 +00:00
|
|
|
address ||
|
2021-07-14 14:41:32 +00:00
|
|
|
(
|
|
|
|
await getDb().get(`${eContractid.WETHGateway}.${DRE.network.name}`).value()
|
|
|
|
).address,
|
2020-10-28 17:06:24 +00:00
|
|
|
await getFirstSigner()
|
|
|
|
);
|
|
|
|
|
2020-10-29 11:44:21 +00:00
|
|
|
export const getWETHMocked = async (address?: tEthereumAddress) =>
|
2020-11-18 18:18:02 +00:00
|
|
|
await WETH9MockedFactory.connect(
|
2020-11-05 12:44:20 +00:00
|
|
|
address || (await getDb().get(`${eContractid.WETHMocked}.${DRE.network.name}`).value()).address,
|
2020-10-29 11:44:21 +00:00
|
|
|
await getFirstSigner()
|
|
|
|
);
|
2020-11-02 09:20:59 +00:00
|
|
|
|
2020-10-30 12:40:06 +00:00
|
|
|
export const getMockAToken = async (address?: tEthereumAddress) =>
|
|
|
|
await MockATokenFactory.connect(
|
2020-11-05 12:44:20 +00:00
|
|
|
address || (await getDb().get(`${eContractid.MockAToken}.${DRE.network.name}`).value()).address,
|
2020-10-30 12:40:06 +00:00
|
|
|
await getFirstSigner()
|
|
|
|
);
|
|
|
|
|
|
|
|
export const getMockVariableDebtToken = async (address?: tEthereumAddress) =>
|
|
|
|
await MockVariableDebtTokenFactory.connect(
|
|
|
|
address ||
|
2021-07-14 14:41:32 +00:00
|
|
|
(
|
|
|
|
await getDb().get(`${eContractid.MockVariableDebtToken}.${DRE.network.name}`).value()
|
|
|
|
).address,
|
2020-10-30 12:40:06 +00:00
|
|
|
await getFirstSigner()
|
|
|
|
);
|
2020-11-02 09:20:59 +00:00
|
|
|
|
2020-10-30 12:40:06 +00:00
|
|
|
export const getMockStableDebtToken = async (address?: tEthereumAddress) =>
|
|
|
|
await MockStableDebtTokenFactory.connect(
|
|
|
|
address ||
|
2021-07-14 14:41:32 +00:00
|
|
|
(
|
|
|
|
await getDb().get(`${eContractid.MockStableDebtToken}.${DRE.network.name}`).value()
|
|
|
|
).address,
|
2020-10-30 12:40:06 +00:00
|
|
|
await getFirstSigner()
|
|
|
|
);
|
2020-11-03 16:23:35 +00:00
|
|
|
|
|
|
|
export const getSelfdestructTransferMock = async (address?: tEthereumAddress) =>
|
|
|
|
await SelfdestructTransferFactory.connect(
|
|
|
|
address ||
|
2021-07-14 14:41:32 +00:00
|
|
|
(
|
|
|
|
await getDb().get(`${eContractid.SelfdestructTransferMock}.${DRE.network.name}`).value()
|
|
|
|
).address,
|
2020-11-03 16:23:35 +00:00
|
|
|
await getFirstSigner()
|
|
|
|
);
|
2020-11-10 12:11:33 +00:00
|
|
|
|
|
|
|
export const getProxy = async (address: tEthereumAddress) =>
|
|
|
|
await InitializableAdminUpgradeabilityProxyFactory.connect(address, await getFirstSigner());
|
|
|
|
|
|
|
|
export const getLendingPoolImpl = async (address?: tEthereumAddress) =>
|
|
|
|
await LendingPoolFactory.connect(
|
|
|
|
address ||
|
2021-07-14 14:41:32 +00:00
|
|
|
(
|
|
|
|
await getDb().get(`${eContractid.LendingPoolImpl}.${DRE.network.name}`).value()
|
|
|
|
).address,
|
2020-11-10 12:11:33 +00:00
|
|
|
await getFirstSigner()
|
|
|
|
);
|
|
|
|
|
|
|
|
export const getLendingPoolConfiguratorImpl = async (address?: tEthereumAddress) =>
|
|
|
|
await LendingPoolConfiguratorFactory.connect(
|
|
|
|
address ||
|
2021-07-14 14:41:32 +00:00
|
|
|
(
|
|
|
|
await getDb().get(`${eContractid.LendingPoolConfiguratorImpl}.${DRE.network.name}`).value()
|
|
|
|
).address,
|
2020-11-10 12:11:33 +00:00
|
|
|
await getFirstSigner()
|
|
|
|
);
|
|
|
|
|
|
|
|
export const getLendingPoolCollateralManagerImpl = async (address?: tEthereumAddress) =>
|
|
|
|
await LendingPoolCollateralManagerFactory.connect(
|
|
|
|
address ||
|
|
|
|
(
|
|
|
|
await getDb()
|
|
|
|
.get(`${eContractid.LendingPoolCollateralManagerImpl}.${DRE.network.name}`)
|
|
|
|
.value()
|
|
|
|
).address,
|
|
|
|
await getFirstSigner()
|
|
|
|
);
|
|
|
|
|
|
|
|
export const getWalletProvider = async (address?: tEthereumAddress) =>
|
|
|
|
await WalletBalanceProviderFactory.connect(
|
|
|
|
address ||
|
2021-07-14 14:41:32 +00:00
|
|
|
(
|
|
|
|
await getDb().get(`${eContractid.WalletBalanceProvider}.${DRE.network.name}`).value()
|
|
|
|
).address,
|
2020-11-10 12:11:33 +00:00
|
|
|
await getFirstSigner()
|
|
|
|
);
|
|
|
|
|
|
|
|
export const getLendingPoolCollateralManager = async (address?: tEthereumAddress) =>
|
|
|
|
await LendingPoolCollateralManagerFactory.connect(
|
|
|
|
address ||
|
2021-07-14 14:41:32 +00:00
|
|
|
(
|
|
|
|
await getDb().get(`${eContractid.LendingPoolCollateralManager}.${DRE.network.name}`).value()
|
|
|
|
).address,
|
2020-11-10 12:11:33 +00:00
|
|
|
await getFirstSigner()
|
|
|
|
);
|
2020-11-10 13:18:48 +00:00
|
|
|
|
2020-12-02 09:58:44 +00:00
|
|
|
export const getAddressById = async (id: string): Promise<tEthereumAddress | undefined> =>
|
|
|
|
(await getDb().get(`${id}.${DRE.network.name}`).value())?.address || undefined;
|
2020-11-12 13:12:26 +00:00
|
|
|
|
2020-11-18 18:18:02 +00:00
|
|
|
export const getAaveOracle = async (address?: tEthereumAddress) =>
|
2020-11-17 09:24:24 +00:00
|
|
|
await AaveOracleFactory.connect(
|
|
|
|
address || (await getDb().get(`${eContractid.AaveOracle}.${DRE.network.name}`).value()).address,
|
2020-11-12 13:12:26 +00:00
|
|
|
await getFirstSigner()
|
|
|
|
);
|
2020-11-17 16:21:41 +00:00
|
|
|
|
2020-10-29 20:29:41 +00:00
|
|
|
export const getMockUniswapRouter = async (address?: tEthereumAddress) =>
|
|
|
|
await MockUniswapV2Router02Factory.connect(
|
|
|
|
address ||
|
2021-07-14 14:41:32 +00:00
|
|
|
(
|
|
|
|
await getDb().get(`${eContractid.MockUniswapV2Router02}.${DRE.network.name}`).value()
|
|
|
|
).address,
|
2020-10-29 20:29:41 +00:00
|
|
|
await getFirstSigner()
|
|
|
|
);
|
|
|
|
|
|
|
|
export const getUniswapLiquiditySwapAdapter = async (address?: tEthereumAddress) =>
|
|
|
|
await UniswapLiquiditySwapAdapterFactory.connect(
|
|
|
|
address ||
|
2021-07-14 14:41:32 +00:00
|
|
|
(
|
|
|
|
await getDb().get(`${eContractid.UniswapLiquiditySwapAdapter}.${DRE.network.name}`).value()
|
|
|
|
).address,
|
2020-10-29 20:29:41 +00:00
|
|
|
await getFirstSigner()
|
|
|
|
);
|
|
|
|
|
|
|
|
export const getUniswapRepayAdapter = async (address?: tEthereumAddress) =>
|
|
|
|
await UniswapRepayAdapterFactory.connect(
|
|
|
|
address ||
|
2021-07-14 14:41:32 +00:00
|
|
|
(
|
|
|
|
await getDb().get(`${eContractid.UniswapRepayAdapter}.${DRE.network.name}`).value()
|
|
|
|
).address,
|
2020-10-29 20:29:41 +00:00
|
|
|
await getFirstSigner()
|
|
|
|
);
|
2021-01-15 15:48:54 +00:00
|
|
|
|
|
|
|
export const getFlashLiquidationAdapter = async (address?: tEthereumAddress) =>
|
|
|
|
await FlashLiquidationAdapterFactory.connect(
|
|
|
|
address ||
|
2021-07-14 14:41:32 +00:00
|
|
|
(
|
|
|
|
await getDb().get(`${eContractid.FlashLiquidationAdapter}.${DRE.network.name}`).value()
|
|
|
|
).address,
|
2021-01-15 15:48:54 +00:00
|
|
|
await getFirstSigner()
|
|
|
|
);
|
2021-03-18 15:44:52 +00:00
|
|
|
|
|
|
|
export const getMockParaSwapAugustus = async (address?: tEthereumAddress) =>
|
|
|
|
await MockParaSwapAugustusFactory.connect(
|
|
|
|
address ||
|
|
|
|
(await getDb().get(`${eContractid.MockParaSwapAugustus}.${DRE.network.name}`).value())
|
|
|
|
.address,
|
|
|
|
await getFirstSigner()
|
|
|
|
);
|
|
|
|
|
2021-05-20 22:25:51 +00:00
|
|
|
export const getMockParaSwapAugustusRegistry = async (address?: tEthereumAddress) =>
|
|
|
|
await MockParaSwapAugustusRegistryFactory.connect(
|
|
|
|
address ||
|
|
|
|
(await getDb().get(`${eContractid.MockParaSwapAugustusRegistry}.${DRE.network.name}`).value())
|
|
|
|
.address,
|
|
|
|
await getFirstSigner()
|
|
|
|
);
|
|
|
|
|
2021-03-18 15:44:52 +00:00
|
|
|
export const getParaSwapLiquiditySwapAdapter = async (address?: tEthereumAddress) =>
|
|
|
|
await ParaSwapLiquiditySwapAdapterFactory.connect(
|
|
|
|
address ||
|
|
|
|
(await getDb().get(`${eContractid.ParaSwapLiquiditySwapAdapter}.${DRE.network.name}`).value())
|
|
|
|
.address,
|
|
|
|
await getFirstSigner()
|
|
|
|
);
|