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 // Prevent to load scripts before compilation and typechain
if (!SKIP_LOAD) { if (!SKIP_LOAD) {
console.log('NOT SKPP');
['misc', 'migrations', 'dev', 'full'].forEach((folder) => { ['misc', 'migrations', 'dev', 'full'].forEach((folder) => {
const tasksPath = path.join(__dirname, 'tasks', folder); const tasksPath = path.join(__dirname, 'tasks', folder);
fs.readdirSync(tasksPath) fs.readdirSync(tasksPath)

View File

@ -87,11 +87,13 @@ export const getWethAddress = async (config: ICommonConfiguration) => {
const currentNetwork = DRE.network.name; const currentNetwork = DRE.network.name;
const wethAddress = getParamPerNetwork(config.WETH, <eEthereumNetwork>currentNetwork); const wethAddress = getParamPerNetwork(config.WETH, <eEthereumNetwork>currentNetwork);
if (wethAddress) { if (wethAddress) {
console.log('here', wethAddress);
return wethAddress; return wethAddress;
} }
if (currentNetwork.includes('main')) { if (currentNetwork.includes('main')) {
throw new Error('WETH not set at mainnet configuration.'); throw new Error('WETH not set at mainnet configuration.');
} }
const weth = await deployWETHMocked(); const weth = await deployWETHMocked();
console.log('here2');
return weth.address; return weth.address;
}; };

View File

@ -52,12 +52,13 @@ import {withSaveAndVerify, registerContractInJsonDb, linkBytecode} from './contr
import {StableAndVariableTokensHelperFactory} from '../types/StableAndVariableTokensHelperFactory'; import {StableAndVariableTokensHelperFactory} from '../types/StableAndVariableTokensHelperFactory';
import {MintableDelegationErc20} from '../types/MintableDelegationErc20'; import {MintableDelegationErc20} from '../types/MintableDelegationErc20';
import {readArtifact as buidlerReadArtifact} from '@nomiclabs/buidler/plugins'; import {readArtifact as buidlerReadArtifact} from '@nomiclabs/buidler/plugins';
import {HardhatRuntimeEnvironment} from 'hardhat/types';
const readArtifact = async (id: string) => { const readArtifact = async (id: string) => {
if (DRE.network.name === eEthereumNetwork.buidlerevm) { if (DRE.network.name === eEthereumNetwork.buidlerevm) {
return buidlerReadArtifact(DRE.config.paths.artifacts, id); 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) => export const deployLendingPoolAddressesProvider = async (verify?: boolean) =>
withSaveAndVerify( withSaveAndVerify(

View File

@ -125,14 +125,14 @@ export const getParamPerNetwork = <T>(
return coverage; return coverage;
case eEthereumNetwork.buidlerevm: case eEthereumNetwork.buidlerevm:
return buidlerevm; return buidlerevm;
case eEthereumNetwork.hardhat:
return buidlerevm;
case eEthereumNetwork.kovan: case eEthereumNetwork.kovan:
return kovan; return kovan;
case eEthereumNetwork.ropsten: case eEthereumNetwork.ropsten:
return ropsten; return ropsten;
case eEthereumNetwork.main: case eEthereumNetwork.main:
return main; return main;
default:
return main;
} }
}; };