mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Removed dev task
This commit is contained in:
parent
84d95038a0
commit
36e5642f24
|
@ -1,241 +1,241 @@
|
|||
import { Contract } from 'ethers';
|
||||
import { DRE } from './misc-utils';
|
||||
import {
|
||||
tEthereumAddress,
|
||||
eContractid,
|
||||
tStringTokenSmallUnits,
|
||||
AavePools,
|
||||
TokenContractId,
|
||||
iMultiPoolsAssets,
|
||||
IReserveParams,
|
||||
PoolConfiguration,
|
||||
eEthereumNetwork,
|
||||
} from './types';
|
||||
// import { Contract } from 'ethers';
|
||||
// import { DRE } from './misc-utils';
|
||||
// import {
|
||||
// tEthereumAddress,
|
||||
// eContractid,
|
||||
// tStringTokenSmallUnits,
|
||||
// AavePools,
|
||||
// TokenContractId,
|
||||
// iMultiPoolsAssets,
|
||||
// IReserveParams,
|
||||
// PoolConfiguration,
|
||||
// eEthereumNetwork,
|
||||
// } from './types';
|
||||
|
||||
import { MintableERC20 } from '../types/MintableERC20';
|
||||
import { MockContract } from 'ethereum-waffle';
|
||||
import { getReservesConfigByPool } from './configuration';
|
||||
import { getFirstSigner } from './contracts-getters';
|
||||
import { ZERO_ADDRESS } from './constants';
|
||||
import {
|
||||
AaveProtocolDataProviderFactory,
|
||||
ATokenFactory,
|
||||
ATokensAndRatesHelperFactory,
|
||||
AaveOracleFactory,
|
||||
DefaultReserveInterestRateStrategyFactory,
|
||||
DelegationAwareATokenFactory,
|
||||
InitializableAdminUpgradeabilityProxyFactory,
|
||||
LendingPoolAddressesProviderFactory,
|
||||
LendingPoolAddressesProviderRegistryFactory,
|
||||
LendingPoolCollateralManagerFactory,
|
||||
LendingPoolConfiguratorFactory,
|
||||
LendingPoolFactory,
|
||||
LendingRateOracleFactory,
|
||||
MintableDelegationERC20Factory,
|
||||
MintableERC20Factory,
|
||||
MockAggregatorFactory,
|
||||
MockATokenFactory,
|
||||
MockFlashLoanReceiverFactory,
|
||||
MockStableDebtTokenFactory,
|
||||
MockVariableDebtTokenFactory,
|
||||
PriceOracleFactory,
|
||||
ReserveLogicFactory,
|
||||
SelfdestructTransferFactory,
|
||||
StableDebtTokenFactory,
|
||||
VariableDebtTokenFactory,
|
||||
WalletBalanceProviderFactory,
|
||||
WETH9MockedFactory,
|
||||
WETHGatewayFactory,
|
||||
} from '../types';
|
||||
import {
|
||||
withSaveAndVerify,
|
||||
registerContractInJsonDb,
|
||||
linkBytecode,
|
||||
insertContractAddressInDb,
|
||||
} from './contracts-helpers';
|
||||
import { StableAndVariableTokensHelperFactory } from '../types/StableAndVariableTokensHelperFactory';
|
||||
import { MintableDelegationERC20 } from '../types/MintableDelegationERC20';
|
||||
import { readArtifact as buidlerReadArtifact } from '@nomiclabs/buidler/plugins';
|
||||
import { HardhatRuntimeEnvironment } from 'hardhat/types';
|
||||
import { LendingPoolLibraryAddresses } from '../types/LendingPoolFactory';
|
||||
// import { MintableERC20 } from '../types/MintableERC20';
|
||||
// import { MockContract } from 'ethereum-waffle';
|
||||
// import { getReservesConfigByPool } from './configuration';
|
||||
// import { getFirstSigner } from './contracts-getters';
|
||||
// import { ZERO_ADDRESS } from './constants';
|
||||
// import {
|
||||
// AaveProtocolDataProviderFactory,
|
||||
// ATokenFactory,
|
||||
// ATokensAndRatesHelperFactory,
|
||||
// AaveOracleFactory,
|
||||
// DefaultReserveInterestRateStrategyFactory,
|
||||
// DelegationAwareATokenFactory,
|
||||
// InitializableAdminUpgradeabilityProxyFactory,
|
||||
// LendingPoolAddressesProviderFactory,
|
||||
// LendingPoolAddressesProviderRegistryFactory,
|
||||
// LendingPoolCollateralManagerFactory,
|
||||
// LendingPoolConfiguratorFactory,
|
||||
// LendingPoolFactory,
|
||||
// LendingRateOracleFactory,
|
||||
// MintableDelegationERC20Factory,
|
||||
// MintableERC20Factory,
|
||||
// MockAggregatorFactory,
|
||||
// MockATokenFactory,
|
||||
// MockFlashLoanReceiverFactory,
|
||||
// MockStableDebtTokenFactory,
|
||||
// MockVariableDebtTokenFactory,
|
||||
// PriceOracleFactory,
|
||||
// ReserveLogicFactory,
|
||||
// SelfdestructTransferFactory,
|
||||
// StableDebtTokenFactory,
|
||||
// VariableDebtTokenFactory,
|
||||
// WalletBalanceProviderFactory,
|
||||
// WETH9MockedFactory,
|
||||
// WETHGatewayFactory,
|
||||
// } from '../types';
|
||||
// import {
|
||||
// withSaveAndVerify,
|
||||
// registerContractInJsonDb,
|
||||
// linkBytecode,
|
||||
// insertContractAddressInDb,
|
||||
// } from './contracts-helpers';
|
||||
// import { StableAndVariableTokensHelperFactory } from '../types/StableAndVariableTokensHelperFactory';
|
||||
// import { MintableDelegationERC20 } from '../types/MintableDelegationERC20';
|
||||
// import { readArtifact as buidlerReadArtifact } from '@nomiclabs/buidler/plugins';
|
||||
// import { HardhatRuntimeEnvironment } from 'hardhat/types';
|
||||
// import { LendingPoolLibraryAddresses } from '../types/LendingPoolFactory';
|
||||
|
||||
const readArtifact = async (id: string) => {
|
||||
if (DRE.network.name === eEthereumNetwork.buidlerevm) {
|
||||
return buidlerReadArtifact(DRE.config.paths.artifacts, id);
|
||||
}
|
||||
return (DRE as HardhatRuntimeEnvironment).artifacts.readArtifact(id);
|
||||
};
|
||||
// const readArtifact = async (id: string) => {
|
||||
// if (DRE.network.name === eEthereumNetwork.buidlerevm) {
|
||||
// return buidlerReadArtifact(DRE.config.paths.artifacts, id);
|
||||
// }
|
||||
// return (DRE as HardhatRuntimeEnvironment).artifacts.readArtifact(id);
|
||||
// };
|
||||
|
||||
export const deployUniswapLendingPoolAddressesProvider = async (marketId: string, verify?: boolean) =>
|
||||
withSaveAndVerify(
|
||||
await new LendingPoolAddressesProviderFactory(await getFirstSigner()).deploy(marketId),
|
||||
eContractid.UniswapLendingPoolAddressesProvider,
|
||||
[marketId],
|
||||
verify
|
||||
);
|
||||
// export const deployUniswapLendingPoolAddressesProvider = async (marketId: string, verify?: boolean) =>
|
||||
// withSaveAndVerify(
|
||||
// await new LendingPoolAddressesProviderFactory(await getFirstSigner()).deploy(marketId),
|
||||
// eContractid.UniswapLendingPoolAddressesProvider,
|
||||
// [marketId],
|
||||
// verify
|
||||
// );
|
||||
|
||||
export const deployUniswapLendingPoolConfigurator = async (verify?: boolean) => {
|
||||
const lendingPoolConfiguratorImpl = await new LendingPoolConfiguratorFactory(
|
||||
await getFirstSigner()
|
||||
).deploy();
|
||||
await insertContractAddressInDb(
|
||||
eContractid.UniswapLendingPoolConfiguratorImpl,
|
||||
lendingPoolConfiguratorImpl.address
|
||||
);
|
||||
return withSaveAndVerify(
|
||||
lendingPoolConfiguratorImpl,
|
||||
eContractid.UniswapLendingPoolConfigurator,
|
||||
[],
|
||||
verify
|
||||
);
|
||||
};
|
||||
// export const deployUniswapLendingPoolConfigurator = async (verify?: boolean) => {
|
||||
// const lendingPoolConfiguratorImpl = await new LendingPoolConfiguratorFactory(
|
||||
// await getFirstSigner()
|
||||
// ).deploy();
|
||||
// await insertContractAddressInDb(
|
||||
// eContractid.UniswapLendingPoolConfiguratorImpl,
|
||||
// lendingPoolConfiguratorImpl.address
|
||||
// );
|
||||
// return withSaveAndVerify(
|
||||
// lendingPoolConfiguratorImpl,
|
||||
// eContractid.UniswapLendingPoolConfigurator,
|
||||
// [],
|
||||
// verify
|
||||
// );
|
||||
// };
|
||||
|
||||
export const deployUniswapLendingPool = async (verify?: boolean) => {
|
||||
const libraries = await deployAaveLibraries(verify);
|
||||
const lendingPoolImpl = await new LendingPoolFactory(libraries, await getFirstSigner()).deploy();
|
||||
await insertContractAddressInDb(eContractid.UniswapLendingPoolImpl, lendingPoolImpl.address);
|
||||
return withSaveAndVerify(lendingPoolImpl, eContractid.LendingPool, [], verify);
|
||||
};
|
||||
// export const deployUniswapLendingPool = async (verify?: boolean) => {
|
||||
// const libraries = await deployAaveLibraries(verify);
|
||||
// const lendingPoolImpl = await new LendingPoolFactory(libraries, await getFirstSigner()).deploy();
|
||||
// await insertContractAddressInDb(eContractid.UniswapLendingPoolImpl, lendingPoolImpl.address);
|
||||
// return withSaveAndVerify(lendingPoolImpl, eContractid.LendingPool, [], verify);
|
||||
// };
|
||||
|
||||
export const deployReserveLogicLibrary = async (verify?: boolean) =>
|
||||
withSaveAndVerify(
|
||||
await new ReserveLogicFactory(await getFirstSigner()).deploy(),
|
||||
eContractid.ReserveLogic,
|
||||
[],
|
||||
verify
|
||||
);
|
||||
// export const deployReserveLogicLibrary = async (verify?: boolean) =>
|
||||
// withSaveAndVerify(
|
||||
// await new ReserveLogicFactory(await getFirstSigner()).deploy(),
|
||||
// eContractid.ReserveLogic,
|
||||
// [],
|
||||
// verify
|
||||
// );
|
||||
|
||||
export const deployGenericLogic = async (reserveLogic: Contract, verify?: boolean) => {
|
||||
const genericLogicArtifact = await readArtifact(eContractid.GenericLogic);
|
||||
// export const deployGenericLogic = async (reserveLogic: Contract, verify?: boolean) => {
|
||||
// const genericLogicArtifact = await readArtifact(eContractid.GenericLogic);
|
||||
|
||||
const linkedGenericLogicByteCode = linkBytecode(genericLogicArtifact, {
|
||||
[eContractid.ReserveLogic]: reserveLogic.address,
|
||||
});
|
||||
// const linkedGenericLogicByteCode = linkBytecode(genericLogicArtifact, {
|
||||
// [eContractid.ReserveLogic]: reserveLogic.address,
|
||||
// });
|
||||
|
||||
const genericLogicFactory = await DRE.ethers.getContractFactory(
|
||||
genericLogicArtifact.abi,
|
||||
linkedGenericLogicByteCode
|
||||
);
|
||||
// const genericLogicFactory = await DRE.ethers.getContractFactory(
|
||||
// genericLogicArtifact.abi,
|
||||
// linkedGenericLogicByteCode
|
||||
// );
|
||||
|
||||
const genericLogic = await (await genericLogicFactory.deploy()).deployed();
|
||||
return withSaveAndVerify(genericLogic, eContractid.GenericLogic, [], verify);
|
||||
};
|
||||
// const genericLogic = await (await genericLogicFactory.deploy()).deployed();
|
||||
// return withSaveAndVerify(genericLogic, eContractid.GenericLogic, [], verify);
|
||||
// };
|
||||
|
||||
export const deployValidationLogic = async (
|
||||
reserveLogic: Contract,
|
||||
genericLogic: Contract,
|
||||
verify?: boolean
|
||||
) => {
|
||||
const validationLogicArtifact = await readArtifact(eContractid.ValidationLogic);
|
||||
// export const deployValidationLogic = async (
|
||||
// reserveLogic: Contract,
|
||||
// genericLogic: Contract,
|
||||
// verify?: boolean
|
||||
// ) => {
|
||||
// const validationLogicArtifact = await readArtifact(eContractid.ValidationLogic);
|
||||
|
||||
const linkedValidationLogicByteCode = linkBytecode(validationLogicArtifact, {
|
||||
[eContractid.ReserveLogic]: reserveLogic.address,
|
||||
[eContractid.GenericLogic]: genericLogic.address,
|
||||
});
|
||||
// const linkedValidationLogicByteCode = linkBytecode(validationLogicArtifact, {
|
||||
// [eContractid.ReserveLogic]: reserveLogic.address,
|
||||
// [eContractid.GenericLogic]: genericLogic.address,
|
||||
// });
|
||||
|
||||
const validationLogicFactory = await DRE.ethers.getContractFactory(
|
||||
validationLogicArtifact.abi,
|
||||
linkedValidationLogicByteCode
|
||||
);
|
||||
// const validationLogicFactory = await DRE.ethers.getContractFactory(
|
||||
// validationLogicArtifact.abi,
|
||||
// linkedValidationLogicByteCode
|
||||
// );
|
||||
|
||||
const validationLogic = await (await validationLogicFactory.deploy()).deployed();
|
||||
// const validationLogic = await (await validationLogicFactory.deploy()).deployed();
|
||||
|
||||
return withSaveAndVerify(validationLogic, eContractid.ValidationLogic, [], verify);
|
||||
};
|
||||
// return withSaveAndVerify(validationLogic, eContractid.ValidationLogic, [], verify);
|
||||
// };
|
||||
|
||||
export const deployAaveLibraries = async (
|
||||
verify?: boolean
|
||||
): Promise<LendingPoolLibraryAddresses> => {
|
||||
const reserveLogic = await deployReserveLogicLibrary(verify);
|
||||
const genericLogic = await deployGenericLogic(reserveLogic, verify);
|
||||
const validationLogic = await deployValidationLogic(reserveLogic, genericLogic, verify);
|
||||
// export const deployAaveLibraries = async (
|
||||
// verify?: boolean
|
||||
// ): Promise<LendingPoolLibraryAddresses> => {
|
||||
// const reserveLogic = await deployReserveLogicLibrary(verify);
|
||||
// const genericLogic = await deployGenericLogic(reserveLogic, verify);
|
||||
// const validationLogic = await deployValidationLogic(reserveLogic, genericLogic, verify);
|
||||
|
||||
// Hardcoded solidity placeholders, if any library changes path this will fail.
|
||||
// The '__$PLACEHOLDER$__ can be calculated via solidity keccak, but the LendingPoolLibraryAddresses Type seems to
|
||||
// require a hardcoded string.
|
||||
//
|
||||
// how-to:
|
||||
// 1. PLACEHOLDER = solidityKeccak256(['string'], `${libPath}:${libName}`).slice(2, 36)
|
||||
// 2. LIB_PLACEHOLDER = `__$${PLACEHOLDER}$__`
|
||||
// or grab placeholdes from LendingPoolLibraryAddresses at Typechain generation.
|
||||
//
|
||||
// libPath example: contracts/libraries/logic/GenericLogic.sol
|
||||
// libName example: GenericLogic
|
||||
return {
|
||||
['__$de8c0cf1a7d7c36c802af9a64fb9d86036$__']: validationLogic.address,
|
||||
['__$22cd43a9dda9ce44e9b92ba393b88fb9ac$__']: reserveLogic.address,
|
||||
};
|
||||
};
|
||||
// // Hardcoded solidity placeholders, if any library changes path this will fail.
|
||||
// // The '__$PLACEHOLDER$__ can be calculated via solidity keccak, but the LendingPoolLibraryAddresses Type seems to
|
||||
// // require a hardcoded string.
|
||||
// //
|
||||
// // how-to:
|
||||
// // 1. PLACEHOLDER = solidityKeccak256(['string'], `${libPath}:${libName}`).slice(2, 36)
|
||||
// // 2. LIB_PLACEHOLDER = `__$${PLACEHOLDER}$__`
|
||||
// // or grab placeholdes from LendingPoolLibraryAddresses at Typechain generation.
|
||||
// //
|
||||
// // libPath example: contracts/libraries/logic/GenericLogic.sol
|
||||
// // libName example: GenericLogic
|
||||
// return {
|
||||
// ['__$de8c0cf1a7d7c36c802af9a64fb9d86036$__']: validationLogic.address,
|
||||
// ['__$22cd43a9dda9ce44e9b92ba393b88fb9ac$__']: reserveLogic.address,
|
||||
// };
|
||||
// };
|
||||
|
||||
export const deployUniswapPriceOracle = async (verify?: boolean) =>
|
||||
withSaveAndVerify(
|
||||
await new PriceOracleFactory(await getFirstSigner()).deploy(),
|
||||
eContractid.UniswapPriceOracle,
|
||||
[],
|
||||
verify
|
||||
);
|
||||
// export const deployUniswapPriceOracle = async (verify?: boolean) =>
|
||||
// withSaveAndVerify(
|
||||
// await new PriceOracleFactory(await getFirstSigner()).deploy(),
|
||||
// eContractid.UniswapPriceOracle,
|
||||
// [],
|
||||
// verify
|
||||
// );
|
||||
|
||||
export const deployUniswapLendingRateOracle = async (verify?: boolean) =>
|
||||
withSaveAndVerify(
|
||||
await new LendingRateOracleFactory(await getFirstSigner()).deploy(),
|
||||
eContractid.UniswapLendingRateOracle,
|
||||
[],
|
||||
verify
|
||||
);
|
||||
// export const deployUniswapLendingRateOracle = async (verify?: boolean) =>
|
||||
// withSaveAndVerify(
|
||||
// await new LendingRateOracleFactory(await getFirstSigner()).deploy(),
|
||||
// eContractid.UniswapLendingRateOracle,
|
||||
// [],
|
||||
// verify
|
||||
// );
|
||||
|
||||
export const deployUniswapAaveOracle = async (
|
||||
args: [tEthereumAddress[], tEthereumAddress[], tEthereumAddress, tEthereumAddress],
|
||||
verify?: boolean
|
||||
) =>
|
||||
withSaveAndVerify(
|
||||
await new AaveOracleFactory(await getFirstSigner()).deploy(...args),
|
||||
eContractid.UniswapAaveOracle,
|
||||
args,
|
||||
verify
|
||||
);
|
||||
// export const deployUniswapAaveOracle = async (
|
||||
// args: [tEthereumAddress[], tEthereumAddress[], tEthereumAddress, tEthereumAddress],
|
||||
// verify?: boolean
|
||||
// ) =>
|
||||
// withSaveAndVerify(
|
||||
// await new AaveOracleFactory(await getFirstSigner()).deploy(...args),
|
||||
// eContractid.UniswapAaveOracle,
|
||||
// args,
|
||||
// verify
|
||||
// );
|
||||
|
||||
export const deployUniswapLendingPoolCollateralManager = async (verify?: boolean) => {
|
||||
const collateralManagerImpl = await new LendingPoolCollateralManagerFactory(
|
||||
await getFirstSigner()
|
||||
).deploy();
|
||||
await insertContractAddressInDb(
|
||||
eContractid.UniswapLendingPoolCollateralManagerImpl,
|
||||
collateralManagerImpl.address
|
||||
);
|
||||
return withSaveAndVerify(
|
||||
collateralManagerImpl,
|
||||
eContractid.UniswapLendingPoolCollateralManager,
|
||||
[],
|
||||
verify
|
||||
);
|
||||
};
|
||||
// export const deployUniswapLendingPoolCollateralManager = async (verify?: boolean) => {
|
||||
// const collateralManagerImpl = await new LendingPoolCollateralManagerFactory(
|
||||
// await getFirstSigner()
|
||||
// ).deploy();
|
||||
// await insertContractAddressInDb(
|
||||
// eContractid.UniswapLendingPoolCollateralManagerImpl,
|
||||
// collateralManagerImpl.address
|
||||
// );
|
||||
// return withSaveAndVerify(
|
||||
// collateralManagerImpl,
|
||||
// eContractid.UniswapLendingPoolCollateralManager,
|
||||
// [],
|
||||
// verify
|
||||
// );
|
||||
// };
|
||||
|
||||
export const deployUniswapMockFlashLoanReceiver = async (
|
||||
addressesProvider: tEthereumAddress,
|
||||
verify?: boolean
|
||||
) =>
|
||||
withSaveAndVerify(
|
||||
await new MockFlashLoanReceiverFactory(await getFirstSigner()).deploy(addressesProvider),
|
||||
eContractid.UniswapMockFlashLoanReceiver,
|
||||
[addressesProvider],
|
||||
verify
|
||||
);
|
||||
// export const deployUniswapMockFlashLoanReceiver = async (
|
||||
// addressesProvider: tEthereumAddress,
|
||||
// verify?: boolean
|
||||
// ) =>
|
||||
// withSaveAndVerify(
|
||||
// await new MockFlashLoanReceiverFactory(await getFirstSigner()).deploy(addressesProvider),
|
||||
// eContractid.UniswapMockFlashLoanReceiver,
|
||||
// [addressesProvider],
|
||||
// verify
|
||||
// );
|
||||
|
||||
export const deployUniswapWalletBalancerProvider = async (verify?: boolean) =>
|
||||
withSaveAndVerify(
|
||||
await new WalletBalanceProviderFactory(await getFirstSigner()).deploy(),
|
||||
eContractid.UniswapWalletBalanceProvider,
|
||||
[],
|
||||
verify
|
||||
);
|
||||
// export const deployUniswapWalletBalancerProvider = async (verify?: boolean) =>
|
||||
// withSaveAndVerify(
|
||||
// await new WalletBalanceProviderFactory(await getFirstSigner()).deploy(),
|
||||
// eContractid.UniswapWalletBalanceProvider,
|
||||
// [],
|
||||
// verify
|
||||
// );
|
||||
|
||||
export const deployUniswapWETHGateway = async (
|
||||
args: [tEthereumAddress, tEthereumAddress],
|
||||
verify?: boolean
|
||||
) =>
|
||||
withSaveAndVerify(
|
||||
await new WETHGatewayFactory(await getFirstSigner()).deploy(...args),
|
||||
eContractid.UniswapWETHGateway,
|
||||
args,
|
||||
verify
|
||||
);
|
||||
// export const deployUniswapWETHGateway = async (
|
||||
// args: [tEthereumAddress, tEthereumAddress],
|
||||
// verify?: boolean
|
||||
// ) =>
|
||||
// withSaveAndVerify(
|
||||
// await new WETHGatewayFactory(await getFirstSigner()).deploy(...args),
|
||||
// eContractid.UniswapWETHGateway,
|
||||
// args,
|
||||
// verify
|
||||
// );
|
||||
|
|
|
@ -1,323 +1,323 @@
|
|||
import { task } from 'hardhat/config';
|
||||
import {
|
||||
deployATokensAndRatesHelper,
|
||||
deployStableAndVariableTokensHelper,
|
||||
deployAaveProtocolDataProvider,
|
||||
deployLendingPoolAddressesProvider, //Test
|
||||
} from '../../helpers/contracts-deployments';
|
||||
import {
|
||||
deployUniswapLendingPoolAddressesProvider,
|
||||
deployUniswapLendingPool,
|
||||
deployUniswapLendingPoolConfigurator,
|
||||
deployUniswapPriceOracle,
|
||||
deployUniswapAaveOracle,
|
||||
deployUniswapLendingRateOracle,
|
||||
deployUniswapLendingPoolCollateralManager,
|
||||
deployUniswapMockFlashLoanReceiver,
|
||||
deployUniswapWETHGateway,
|
||||
deployUniswapWalletBalancerProvider,
|
||||
} from '../../helpers/uniswap-contracts-deployments';
|
||||
import { tEthereumAddress,
|
||||
eContractid,
|
||||
AavePools,
|
||||
ICommonConfiguration,
|
||||
iAssetBase,
|
||||
TokenContractId,
|
||||
IMarketRates,
|
||||
} from '../../helpers/types';
|
||||
import {
|
||||
getLendingPoolAddressesProviderRegistry,
|
||||
getLendingPoolAddressesProvider, //Test
|
||||
getLendingPool,
|
||||
getLendingPoolConfiguratorProxy,
|
||||
getAllMockedTokens,
|
||||
getPairsTokenAggregator,
|
||||
} from '../../helpers/contracts-getters';
|
||||
import { waitForTx, filterMapBy } from '../../helpers/misc-utils';
|
||||
import { UniswapConfig } from '../../markets/uniswap';
|
||||
import { insertContractAddressInDb } from '../../helpers/contracts-helpers';
|
||||
import {
|
||||
setInitialAssetPricesInOracle,
|
||||
deployAllMockAggregators,
|
||||
setInitialMarketRatesInRatesOracleByHelper,
|
||||
} from '../../helpers/oracles-helpers';
|
||||
import {getAllAggregatorsAddresses, getAllTokenAddresses} from '../../helpers/mock-helpers';
|
||||
import {
|
||||
ConfigNames,
|
||||
getReservesConfigByPool,
|
||||
getTreasuryAddress,
|
||||
loadPoolConfig,
|
||||
getWethAddress,
|
||||
} from '../../helpers/configuration';
|
||||
import {
|
||||
configureReservesByHelper,
|
||||
initReservesByHelper,
|
||||
} from '../../helpers/init-helpers';
|
||||
import { ZERO_ADDRESS } from '../../helpers/constants';
|
||||
// import { task } from 'hardhat/config';
|
||||
// import {
|
||||
// deployATokensAndRatesHelper,
|
||||
// deployStableAndVariableTokensHelper,
|
||||
// deployAaveProtocolDataProvider,
|
||||
// deployLendingPoolAddressesProvider, //Test
|
||||
// } from '../../helpers/contracts-deployments';
|
||||
// import {
|
||||
// deployUniswapLendingPoolAddressesProvider,
|
||||
// deployUniswapLendingPool,
|
||||
// deployUniswapLendingPoolConfigurator,
|
||||
// deployUniswapPriceOracle,
|
||||
// deployUniswapAaveOracle,
|
||||
// deployUniswapLendingRateOracle,
|
||||
// deployUniswapLendingPoolCollateralManager,
|
||||
// deployUniswapMockFlashLoanReceiver,
|
||||
// deployUniswapWETHGateway,
|
||||
// deployUniswapWalletBalancerProvider,
|
||||
// } from '../../helpers/uniswap-contracts-deployments';
|
||||
// import { tEthereumAddress,
|
||||
// eContractid,
|
||||
// AavePools,
|
||||
// ICommonConfiguration,
|
||||
// iAssetBase,
|
||||
// TokenContractId,
|
||||
// IMarketRates,
|
||||
// } from '../../helpers/types';
|
||||
// import {
|
||||
// getLendingPoolAddressesProviderRegistry,
|
||||
// getLendingPoolAddressesProvider, //Test
|
||||
// getLendingPool,
|
||||
// getLendingPoolConfiguratorProxy,
|
||||
// getAllMockedTokens,
|
||||
// getPairsTokenAggregator,
|
||||
// } from '../../helpers/contracts-getters';
|
||||
// import { waitForTx, filterMapBy } from '../../helpers/misc-utils';
|
||||
// import { UniswapConfig } from '../../markets/uniswap';
|
||||
// import { insertContractAddressInDb } from '../../helpers/contracts-helpers';
|
||||
// import {
|
||||
// setInitialAssetPricesInOracle,
|
||||
// deployAllMockAggregators,
|
||||
// setInitialMarketRatesInRatesOracleByHelper,
|
||||
// } from '../../helpers/oracles-helpers';
|
||||
// import {getAllAggregatorsAddresses, getAllTokenAddresses} from '../../helpers/mock-helpers';
|
||||
// import {
|
||||
// ConfigNames,
|
||||
// getReservesConfigByPool,
|
||||
// getTreasuryAddress,
|
||||
// loadPoolConfig,
|
||||
// getWethAddress,
|
||||
// } from '../../helpers/configuration';
|
||||
// import {
|
||||
// configureReservesByHelper,
|
||||
// initReservesByHelper,
|
||||
// } from '../../helpers/init-helpers';
|
||||
// import { ZERO_ADDRESS } from '../../helpers/constants';
|
||||
|
||||
|
||||
const pool = ConfigNames.Uniswap;
|
||||
/**
|
||||
* @dev addressesProvider is actually created here, so we don't need to use getAddressesProvider
|
||||
*/
|
||||
task(
|
||||
'dev:deploy-uniswap-market',
|
||||
'Deploy uniswap market'
|
||||
)
|
||||
.addFlag('verify', 'Verify contracts at Etherscan')
|
||||
.setAction(async ({ verify }, localBRE) => {
|
||||
await localBRE.run('set-DRE');
|
||||
// const pool = ConfigNames.Uniswap;
|
||||
// /**
|
||||
// * @dev addressesProvider is actually created here, so we don't need to use getAddressesProvider
|
||||
// */
|
||||
// task(
|
||||
// 'dev:deploy-uniswap-market',
|
||||
// 'Deploy uniswap market'
|
||||
// )
|
||||
// .addFlag('verify', 'Verify contracts at Etherscan')
|
||||
// .setAction(async ({ verify }, localBRE) => {
|
||||
// await localBRE.run('set-DRE');
|
||||
|
||||
const admin = await (await localBRE.ethers.getSigners())[0].getAddress();
|
||||
// const admin = await (await localBRE.ethers.getSigners())[0].getAddress();
|
||||
|
||||
const testProvider = await getLendingPoolAddressesProvider();
|
||||
console.log("Addresses provider from function (pre re-deploy):", testProvider.address);
|
||||
const addressesProvider = await deployLendingPoolAddressesProvider(UniswapConfig.MarketId, verify);
|
||||
console.log("Addresses provider in execution::", addressesProvider.address)
|
||||
// const testProvider = await getLendingPoolAddressesProvider();
|
||||
// console.log("Addresses provider from function (pre re-deploy):", testProvider.address);
|
||||
// const addressesProvider = await deployLendingPoolAddressesProvider(UniswapConfig.MarketId, verify);
|
||||
// console.log("Addresses provider in execution::", addressesProvider.address)
|
||||
|
||||
const testProviderPost = await getLendingPoolAddressesProvider();
|
||||
console.log("Addresses provider from function (pre re-deploy):", testProviderPost.address);
|
||||
console.log("Addresses provider from function (post re-deploy) should be different:")
|
||||
await waitForTx(await addressesProvider.setPoolAdmin(admin));
|
||||
// const testProviderPost = await getLendingPoolAddressesProvider();
|
||||
// console.log("Addresses provider from function (pre re-deploy):", testProviderPost.address);
|
||||
// console.log("Addresses provider from function (post re-deploy) should be different:")
|
||||
// await waitForTx(await addressesProvider.setPoolAdmin(admin));
|
||||
|
||||
|
||||
const addressesProviderRegistry = await getLendingPoolAddressesProviderRegistry();
|
||||
await waitForTx(
|
||||
await addressesProviderRegistry.registerAddressesProvider(addressesProvider.address, 1)
|
||||
);
|
||||
console.log(addressesProvider.address);
|
||||
// const addressesProviderRegistry = await getLendingPoolAddressesProviderRegistry();
|
||||
// await waitForTx(
|
||||
// await addressesProviderRegistry.registerAddressesProvider(addressesProvider.address, 1)
|
||||
// );
|
||||
// console.log(addressesProvider.address);
|
||||
|
||||
|
||||
/**
|
||||
* LENDING POOL DEPLOYMENT
|
||||
*/
|
||||
const lendingPoolImpl = await deployUniswapLendingPool(verify);
|
||||
// /**
|
||||
// * LENDING POOL DEPLOYMENT
|
||||
// */
|
||||
// const lendingPoolImpl = await deployUniswapLendingPool(verify);
|
||||
|
||||
await waitForTx(await addressesProvider.setLendingPoolImpl(lendingPoolImpl.address));
|
||||
// await waitForTx(await addressesProvider.setLendingPoolImpl(lendingPoolImpl.address));
|
||||
|
||||
const address = await addressesProvider.getLendingPool();
|
||||
console.log("UNISWAP MARKET LENDING POOL:", address);
|
||||
const lendingPoolProxy = await getLendingPool(address);
|
||||
await insertContractAddressInDb(eContractid.UniswapLendingPool, lendingPoolProxy.address);
|
||||
// const address = await addressesProvider.getLendingPool();
|
||||
// console.log("UNISWAP MARKET LENDING POOL:", address);
|
||||
// const lendingPoolProxy = await getLendingPool(address);
|
||||
// await insertContractAddressInDb(eContractid.UniswapLendingPool, lendingPoolProxy.address);
|
||||
|
||||
const lendingPoolConfiguratorImpl = await deployUniswapLendingPoolConfigurator(verify);
|
||||
// const lendingPoolConfiguratorImpl = await deployUniswapLendingPoolConfigurator(verify);
|
||||
|
||||
// Set lending pool conf impl to Address Provider
|
||||
await waitForTx(
|
||||
await addressesProvider.setLendingPoolConfiguratorImpl(lendingPoolConfiguratorImpl.address)
|
||||
);
|
||||
// // Set lending pool conf impl to Address Provider
|
||||
// await waitForTx(
|
||||
// await addressesProvider.setLendingPoolConfiguratorImpl(lendingPoolConfiguratorImpl.address)
|
||||
// );
|
||||
|
||||
const lendingPoolConfiguratorProxy = await getLendingPoolConfiguratorProxy(
|
||||
await addressesProvider.getLendingPoolConfigurator()
|
||||
);
|
||||
// const lendingPoolConfiguratorProxy = await getLendingPoolConfiguratorProxy(
|
||||
// await addressesProvider.getLendingPoolConfigurator()
|
||||
// );
|
||||
|
||||
await insertContractAddressInDb(
|
||||
eContractid.UniswapLendingPoolConfigurator,
|
||||
lendingPoolConfiguratorProxy.address
|
||||
);
|
||||
// await insertContractAddressInDb(
|
||||
// eContractid.UniswapLendingPoolConfigurator,
|
||||
// lendingPoolConfiguratorProxy.address
|
||||
// );
|
||||
|
||||
// Deploy deployment helpers
|
||||
await deployStableAndVariableTokensHelper(
|
||||
[lendingPoolProxy.address, addressesProvider.address],
|
||||
verify
|
||||
);
|
||||
await deployATokensAndRatesHelper(
|
||||
[lendingPoolProxy.address, addressesProvider.address, lendingPoolConfiguratorProxy.address],
|
||||
verify
|
||||
);
|
||||
// // Deploy deployment helpers
|
||||
// await deployStableAndVariableTokensHelper(
|
||||
// [lendingPoolProxy.address, addressesProvider.address],
|
||||
// verify
|
||||
// );
|
||||
// await deployATokensAndRatesHelper(
|
||||
// [lendingPoolProxy.address, addressesProvider.address, lendingPoolConfiguratorProxy.address],
|
||||
// verify
|
||||
// );
|
||||
|
||||
/**
|
||||
* @dev Oracle deployment section
|
||||
*/
|
||||
// /**
|
||||
// * @dev Oracle deployment section
|
||||
// */
|
||||
|
||||
console.log("Uniswap oracle deployment beginning.")
|
||||
const poolConfig = loadPoolConfig(pool);
|
||||
console.log("Initialized pool config...");
|
||||
// console.log("Uniswap oracle deployment beginning.")
|
||||
// const poolConfig = loadPoolConfig(pool);
|
||||
// console.log("Initialized pool config...");
|
||||
|
||||
const {
|
||||
Mocks: {AllAssetsInitialPrices},
|
||||
ProtocolGlobalParams: {UsdAddress, MockUsdPriceInWei},
|
||||
LendingRateOracleRatesCommon,
|
||||
} = poolConfig as ICommonConfiguration;
|
||||
// const {
|
||||
// Mocks: {AllAssetsInitialPrices},
|
||||
// ProtocolGlobalParams: {UsdAddress, MockUsdPriceInWei},
|
||||
// LendingRateOracleRatesCommon,
|
||||
// } = poolConfig as ICommonConfiguration;
|
||||
|
||||
console.log("Initialized mocks, global params and lending rate oracle rates");
|
||||
// console.log("Initialized mocks, global params and lending rate oracle rates");
|
||||
|
||||
const defaultTokenList = {
|
||||
...Object.fromEntries(Object.keys(TokenContractId).map((symbol) => [symbol, ''])),
|
||||
USD: UsdAddress,
|
||||
} as iAssetBase<string>;
|
||||
// const defaultTokenList = {
|
||||
// ...Object.fromEntries(Object.keys(TokenContractId).map((symbol) => [symbol, ''])),
|
||||
// USD: UsdAddress,
|
||||
// } as iAssetBase<string>;
|
||||
|
||||
console.log("Initialized defaultTokenList");
|
||||
// console.log("Initialized defaultTokenList");
|
||||
|
||||
const mockTokens = await getAllMockedTokens();
|
||||
// const mockTokens = await getAllMockedTokens();
|
||||
|
||||
console.log("Initialized mock tokens");
|
||||
// console.log("Initialized mock tokens");
|
||||
|
||||
const mockTokensAddress = Object.keys(mockTokens).reduce<iAssetBase<string>>((prev, curr) => {
|
||||
prev[curr as keyof iAssetBase<string>] = mockTokens[curr].address;
|
||||
return prev;
|
||||
}, defaultTokenList);
|
||||
console.log(mockTokensAddress);
|
||||
console.log("Initialized mock tokens addresses");
|
||||
// const mockTokensAddress = Object.keys(mockTokens).reduce<iAssetBase<string>>((prev, curr) => {
|
||||
// prev[curr as keyof iAssetBase<string>] = mockTokens[curr].address;
|
||||
// return prev;
|
||||
// }, defaultTokenList);
|
||||
// console.log(mockTokensAddress);
|
||||
// console.log("Initialized mock tokens addresses");
|
||||
|
||||
// No need to re-initialize addressesProvider and admin
|
||||
// // No need to re-initialize addressesProvider and admin
|
||||
|
||||
const fallbackOracle = await deployUniswapPriceOracle(verify);
|
||||
console.log("Deployed fallback price oracle");
|
||||
// const fallbackOracle = await deployUniswapPriceOracle(verify);
|
||||
// console.log("Deployed fallback price oracle");
|
||||
|
||||
await waitForTx(await fallbackOracle.setEthUsdPrice(MockUsdPriceInWei));
|
||||
console.log("set fallback ETH USD price");
|
||||
// await waitForTx(await fallbackOracle.setEthUsdPrice(MockUsdPriceInWei));
|
||||
// console.log("set fallback ETH USD price");
|
||||
|
||||
await setInitialAssetPricesInOracle(AllAssetsInitialPrices, mockTokensAddress, fallbackOracle);
|
||||
console.log("Set initial asset prices in oracle");
|
||||
// await setInitialAssetPricesInOracle(AllAssetsInitialPrices, mockTokensAddress, fallbackOracle);
|
||||
// console.log("Set initial asset prices in oracle");
|
||||
|
||||
const mockAggregators = await deployAllMockAggregators(AllAssetsInitialPrices, verify);
|
||||
console.log("Deployed mock aggregators");
|
||||
// const mockAggregators = await deployAllMockAggregators(AllAssetsInitialPrices, verify);
|
||||
// console.log("Deployed mock aggregators");
|
||||
|
||||
const allTokenAddresses = getAllTokenAddresses(mockTokens);
|
||||
console.log("Got all mock token addresses");
|
||||
// const allTokenAddresses = getAllTokenAddresses(mockTokens);
|
||||
// console.log("Got all mock token addresses");
|
||||
|
||||
const allAggregatorsAddresses = getAllAggregatorsAddresses(mockAggregators);
|
||||
console.log("Got all aggregator addresses");
|
||||
console.log("allTokenAddresses object: \n", allTokenAddresses);
|
||||
//Should modify this to potentially contain only the tokens in the Uniswap market
|
||||
// const [tokens, aggregators] = getPairsTokenAggregator(
|
||||
// allTokenAddresses,
|
||||
// allAggregatorsAddresses
|
||||
// );
|
||||
// console.log("Got \"pairsToken aggregator\"");
|
||||
// console.log("Tokens: \n", tokens);
|
||||
// const allAggregatorsAddresses = getAllAggregatorsAddresses(mockAggregators);
|
||||
// console.log("Got all aggregator addresses");
|
||||
// console.log("allTokenAddresses object: \n", allTokenAddresses);
|
||||
// //Should modify this to potentially contain only the tokens in the Uniswap market
|
||||
// // const [tokens, aggregators] = getPairsTokenAggregator(
|
||||
// // allTokenAddresses,
|
||||
// // allAggregatorsAddresses
|
||||
// // );
|
||||
// // console.log("Got \"pairsToken aggregator\"");
|
||||
// // console.log("Tokens: \n", tokens);
|
||||
|
||||
// const assetAddressIndex = Object.keys(allReservesAddresses).findIndex(
|
||||
// (value) => value === assetSymbol
|
||||
// );
|
||||
// const [, assetAddress] = (Object.entries(assetsAddresses) as [string, string][])[
|
||||
// assetAddressIndex
|
||||
// ];
|
||||
// assetAddresses.push(assetAddress);
|
||||
// // const assetAddressIndex = Object.keys(allReservesAddresses).findIndex(
|
||||
// // (value) => value === assetSymbol
|
||||
// // );
|
||||
// // const [, assetAddress] = (Object.entries(assetsAddresses) as [string, string][])[
|
||||
// // assetAddressIndex
|
||||
// // ];
|
||||
// // assetAddresses.push(assetAddress);
|
||||
|
||||
// await deployUniswapAaveOracle(
|
||||
// [tokens, aggregators, fallbackOracle.address, await getWethAddress(poolConfig)],
|
||||
// verify
|
||||
// );
|
||||
console.log("Deployed Uniswap Aave oracle");
|
||||
// // await deployUniswapAaveOracle(
|
||||
// // [tokens, aggregators, fallbackOracle.address, await getWethAddress(poolConfig)],
|
||||
// // verify
|
||||
// // );
|
||||
// console.log("Deployed Uniswap Aave oracle");
|
||||
|
||||
await waitForTx(await addressesProvider.setPriceOracle(fallbackOracle.address));
|
||||
console.log("Set price oracle in addresses provider");
|
||||
// await waitForTx(await addressesProvider.setPriceOracle(fallbackOracle.address));
|
||||
// console.log("Set price oracle in addresses provider");
|
||||
|
||||
const lendingRateOracle = await deployUniswapLendingRateOracle(verify);
|
||||
console.log("Deployed lendingRateOracle");
|
||||
// const lendingRateOracle = await deployUniswapLendingRateOracle(verify);
|
||||
// console.log("Deployed lendingRateOracle");
|
||||
|
||||
await waitForTx(await addressesProvider.setLendingRateOracle(lendingRateOracle.address));
|
||||
console.log("Set lending rate oracle in addresses provider");
|
||||
// await waitForTx(await addressesProvider.setLendingRateOracle(lendingRateOracle.address));
|
||||
// console.log("Set lending rate oracle in addresses provider");
|
||||
|
||||
const {USD, ...tokensAddressesWithoutUsd} = allTokenAddresses;
|
||||
console.log("Initialized object with token addresses & usd")
|
||||
// const {USD, ...tokensAddressesWithoutUsd} = allTokenAddresses;
|
||||
// console.log("Initialized object with token addresses & usd")
|
||||
|
||||
const allReservesAddresses = {
|
||||
...tokensAddressesWithoutUsd,
|
||||
};
|
||||
console.log("Initialized object with all reserve addresses, allReservesAddresses:");
|
||||
console.log(allReservesAddresses);
|
||||
// const allReservesAddresses = {
|
||||
// ...tokensAddressesWithoutUsd,
|
||||
// };
|
||||
// console.log("Initialized object with all reserve addresses, allReservesAddresses:");
|
||||
// console.log(allReservesAddresses);
|
||||
|
||||
console.log("LendingRateOracleRatesCommon: \n", LendingRateOracleRatesCommon);
|
||||
//
|
||||
// -- test
|
||||
//
|
||||
const [tokens, aggregators] = getPairsTokenAggregator(
|
||||
allTokenAddresses,
|
||||
allAggregatorsAddresses
|
||||
);
|
||||
console.log("Got \"pairsToken aggregator\"");
|
||||
console.log("Tokens: \n", tokens);
|
||||
const assetAddresses: string[] = [];
|
||||
const aggregatorAddresses: string[] = [];
|
||||
for (const [assetSymbol, {borrowRate}] of Object.entries(LendingRateOracleRatesCommon) as [
|
||||
string,
|
||||
IMarketRates
|
||||
][]) {
|
||||
const assetAddressIndex = Object.keys(allReservesAddresses).findIndex(
|
||||
(value) => value === assetSymbol
|
||||
);
|
||||
const [, assetAddress] = (Object.entries(allReservesAddresses) as [string, string][])[
|
||||
assetAddressIndex
|
||||
];
|
||||
// console.log("LendingRateOracleRatesCommon: \n", LendingRateOracleRatesCommon);
|
||||
// //
|
||||
// // -- test
|
||||
// //
|
||||
// const [tokens, aggregators] = getPairsTokenAggregator(
|
||||
// allTokenAddresses,
|
||||
// allAggregatorsAddresses
|
||||
// );
|
||||
// console.log("Got \"pairsToken aggregator\"");
|
||||
// console.log("Tokens: \n", tokens);
|
||||
// const assetAddresses: string[] = [];
|
||||
// const aggregatorAddresses: string[] = [];
|
||||
// for (const [assetSymbol, {borrowRate}] of Object.entries(LendingRateOracleRatesCommon) as [
|
||||
// string,
|
||||
// IMarketRates
|
||||
// ][]) {
|
||||
// const assetAddressIndex = Object.keys(allReservesAddresses).findIndex(
|
||||
// (value) => value === assetSymbol
|
||||
// );
|
||||
// const [, assetAddress] = (Object.entries(allReservesAddresses) as [string, string][])[
|
||||
// assetAddressIndex
|
||||
// ];
|
||||
|
||||
const [, aggregatorAddress] = (Object.entries(allAggregatorsAddresses) as [string, string][])[
|
||||
assetAddressIndex
|
||||
];
|
||||
aggregatorAddresses.push(aggregatorAddress);
|
||||
assetAddresses.push(assetAddress);
|
||||
}
|
||||
console.log("\nPRICE ORACLE PARAMS:\nassetAddresses: %s\naggregatorAddresses: %s", assetAddresses, aggregatorAddresses);
|
||||
await deployUniswapAaveOracle(
|
||||
[assetAddresses, aggregatorAddresses, fallbackOracle.address, await getWethAddress(poolConfig)],
|
||||
verify
|
||||
);
|
||||
//
|
||||
// -- test end
|
||||
//
|
||||
console.log("TEST END-----------------------------------------------------------------------");
|
||||
await setInitialMarketRatesInRatesOracleByHelper(
|
||||
LendingRateOracleRatesCommon,
|
||||
allReservesAddresses,
|
||||
lendingRateOracle,
|
||||
admin
|
||||
);
|
||||
// const [, aggregatorAddress] = (Object.entries(allAggregatorsAddresses) as [string, string][])[
|
||||
// assetAddressIndex
|
||||
// ];
|
||||
// aggregatorAddresses.push(aggregatorAddress);
|
||||
// assetAddresses.push(assetAddress);
|
||||
// }
|
||||
// console.log("\nPRICE ORACLE PARAMS:\nassetAddresses: %s\naggregatorAddresses: %s", assetAddresses, aggregatorAddresses);
|
||||
// await deployUniswapAaveOracle(
|
||||
// [assetAddresses, aggregatorAddresses, fallbackOracle.address, await getWethAddress(poolConfig)],
|
||||
// verify
|
||||
// );
|
||||
// //
|
||||
// // -- test end
|
||||
// //
|
||||
// console.log("TEST END-----------------------------------------------------------------------");
|
||||
// await setInitialMarketRatesInRatesOracleByHelper(
|
||||
// LendingRateOracleRatesCommon,
|
||||
// allReservesAddresses,
|
||||
// lendingRateOracle,
|
||||
// admin
|
||||
// );
|
||||
|
||||
console.log("Task complete");
|
||||
// console.log("Task complete");
|
||||
|
||||
/**
|
||||
* @dev Initialization
|
||||
*/
|
||||
// /**
|
||||
// * @dev Initialization
|
||||
// */
|
||||
|
||||
// No need to initialize poolConfig, mockTokens, allTokenAddresses, admin and
|
||||
// addressesProvider and protoReservesAddresses (we use allReserveAddresses)
|
||||
// // No need to initialize poolConfig, mockTokens, allTokenAddresses, admin and
|
||||
// // addressesProvider and protoReservesAddresses (we use allReserveAddresses)
|
||||
|
||||
const testHelpers = await deployAaveProtocolDataProvider(addressesProvider.address, verify);
|
||||
// const testHelpers = await deployAaveProtocolDataProvider(addressesProvider.address, verify);
|
||||
|
||||
const reservesParams = getReservesConfigByPool(AavePools.uniswap);
|
||||
// const reservesParams = getReservesConfigByPool(AavePools.uniswap);
|
||||
|
||||
const treasuryAddress = await getTreasuryAddress(poolConfig);
|
||||
// const treasuryAddress = await getTreasuryAddress(poolConfig);
|
||||
|
||||
await initReservesByHelper(
|
||||
addressesProvider,
|
||||
reservesParams,
|
||||
allReservesAddresses,
|
||||
admin,
|
||||
treasuryAddress,
|
||||
ZERO_ADDRESS,
|
||||
verify
|
||||
);
|
||||
// await initReservesByHelper(
|
||||
// addressesProvider,
|
||||
// reservesParams,
|
||||
// allReservesAddresses,
|
||||
// admin,
|
||||
// treasuryAddress,
|
||||
// ZERO_ADDRESS,
|
||||
// verify
|
||||
// );
|
||||
|
||||
await configureReservesByHelper(
|
||||
addressesProvider,
|
||||
reservesParams,
|
||||
allReservesAddresses,
|
||||
testHelpers,
|
||||
admin
|
||||
);
|
||||
// await configureReservesByHelper(
|
||||
// addressesProvider,
|
||||
// reservesParams,
|
||||
// allReservesAddresses,
|
||||
// testHelpers,
|
||||
// admin
|
||||
// );
|
||||
|
||||
const collateralManager = await deployUniswapLendingPoolCollateralManager(verify);
|
||||
await waitForTx(
|
||||
await addressesProvider.setLendingPoolCollateralManager(collateralManager.address)
|
||||
);
|
||||
// const collateralManager = await deployUniswapLendingPoolCollateralManager(verify);
|
||||
// await waitForTx(
|
||||
// await addressesProvider.setLendingPoolCollateralManager(collateralManager.address)
|
||||
// );
|
||||
|
||||
const mockFlashLoanReceiver = await deployUniswapMockFlashLoanReceiver(
|
||||
addressesProvider.address,
|
||||
verify
|
||||
);
|
||||
// const mockFlashLoanReceiver = await deployUniswapMockFlashLoanReceiver(
|
||||
// addressesProvider.address,
|
||||
// verify
|
||||
// );
|
||||
|
||||
await insertContractAddressInDb(
|
||||
eContractid.UniswapMockFlashLoanReceiver,
|
||||
mockFlashLoanReceiver.address
|
||||
);
|
||||
// await insertContractAddressInDb(
|
||||
// eContractid.UniswapMockFlashLoanReceiver,
|
||||
// mockFlashLoanReceiver.address
|
||||
// );
|
||||
|
||||
await deployUniswapWalletBalancerProvider(verify);
|
||||
// await deployUniswapWalletBalancerProvider(verify);
|
||||
|
||||
await insertContractAddressInDb(eContractid.AaveProtocolDataProvider, testHelpers.address);
|
||||
// await insertContractAddressInDb(eContractid.AaveProtocolDataProvider, testHelpers.address);
|
||||
|
||||
const lendingPoolAddress = await addressesProvider.getLendingPool();
|
||||
const wethAddress = await getWethAddress(poolConfig);
|
||||
await deployUniswapWETHGateway([wethAddress, lendingPoolAddress]);
|
||||
});
|
||||
// const lendingPoolAddress = await addressesProvider.getLendingPool();
|
||||
// const wethAddress = await getWethAddress(poolConfig);
|
||||
// await deployUniswapWETHGateway([wethAddress, lendingPoolAddress]);
|
||||
// });
|
||||
|
|
|
@ -35,8 +35,8 @@ task('aave:dev', 'Deploy development enviroment')
|
|||
console.log('5. Initialize lending pool');
|
||||
await localBRE.run('dev:initialize-lending-pool', {verify, pool: POOL_NAME});
|
||||
|
||||
console.log('6. Deploy Uniswap market');
|
||||
await localBRE.run('dev:deploy-uniswap-market', {verify});
|
||||
// console.log('6. Deploy Uniswap market');
|
||||
// await localBRE.run('dev:deploy-uniswap-market', {verify});
|
||||
|
||||
console.log('\nFinished migration');
|
||||
printContracts();
|
||||
|
|
Loading…
Reference in New Issue
Block a user