From 51b3fb16697552ad87ba0a7e8a10846e64a448c7 Mon Sep 17 00:00:00 2001 From: David Racero Date: Thu, 5 Nov 2020 15:31:35 +0100 Subject: [PATCH] Fix migration logic --- hardhat.config.ts | 1 - helpers/configuration.ts | 2 ++ helpers/contracts-deployments.ts | 3 ++- helpers/contracts-helpers.ts | 4 ++-- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/hardhat.config.ts b/hardhat.config.ts index 7398222d..76c6e3c9 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -23,7 +23,6 @@ const MNEMONIC = process.env.MNEMONIC || ''; // Prevent to load scripts before compilation and typechain if (!SKIP_LOAD) { - console.log('NOT SKPP'); ['misc', 'migrations', 'dev', 'full'].forEach((folder) => { const tasksPath = path.join(__dirname, 'tasks', folder); fs.readdirSync(tasksPath) diff --git a/helpers/configuration.ts b/helpers/configuration.ts index 8faea63f..74f0d027 100644 --- a/helpers/configuration.ts +++ b/helpers/configuration.ts @@ -87,11 +87,13 @@ export const getWethAddress = async (config: ICommonConfiguration) => { const currentNetwork = DRE.network.name; const wethAddress = getParamPerNetwork(config.WETH, currentNetwork); if (wethAddress) { + console.log('here', wethAddress); return wethAddress; } if (currentNetwork.includes('main')) { throw new Error('WETH not set at mainnet configuration.'); } const weth = await deployWETHMocked(); + console.log('here2'); return weth.address; }; diff --git a/helpers/contracts-deployments.ts b/helpers/contracts-deployments.ts index a8185ff3..daacfde4 100644 --- a/helpers/contracts-deployments.ts +++ b/helpers/contracts-deployments.ts @@ -52,12 +52,13 @@ import {withSaveAndVerify, registerContractInJsonDb, linkBytecode} from './contr import {StableAndVariableTokensHelperFactory} from '../types/StableAndVariableTokensHelperFactory'; import {MintableDelegationErc20} from '../types/MintableDelegationErc20'; import {readArtifact as buidlerReadArtifact} from '@nomiclabs/buidler/plugins'; +import {HardhatRuntimeEnvironment} from 'hardhat/types'; const readArtifact = async (id: string) => { if (DRE.network.name === eEthereumNetwork.buidlerevm) { return buidlerReadArtifact(DRE.config.paths.artifacts, id); } - return DRE.artifacts.readArtifact(id); + return (DRE as HardhatRuntimeEnvironment).artifacts.readArtifact(id); }; export const deployLendingPoolAddressesProvider = async (verify?: boolean) => withSaveAndVerify( diff --git a/helpers/contracts-helpers.ts b/helpers/contracts-helpers.ts index d651080e..25624634 100644 --- a/helpers/contracts-helpers.ts +++ b/helpers/contracts-helpers.ts @@ -125,14 +125,14 @@ export const getParamPerNetwork = ( return coverage; case eEthereumNetwork.buidlerevm: return buidlerevm; + case eEthereumNetwork.hardhat: + return buidlerevm; case eEthereumNetwork.kovan: return kovan; case eEthereumNetwork.ropsten: return ropsten; case eEthereumNetwork.main: return main; - default: - return main; } };