Fix migration logic

This commit is contained in:
David Racero 2020-11-05 15:31:35 +01:00
parent 729b642ea5
commit 51b3fb1669
4 changed files with 6 additions and 4 deletions

View File

@ -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)

View File

@ -87,11 +87,13 @@ export const getWethAddress = async (config: ICommonConfiguration) => {
const currentNetwork = DRE.network.name;
const wethAddress = getParamPerNetwork(config.WETH, <eEthereumNetwork>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;
};

View File

@ -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(

View File

@ -125,14 +125,14 @@ export const getParamPerNetwork = <T>(
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;
}
};