diff --git a/hardhat/common-contracts.js b/hardhat/common-contracts.js index 0df05fe836e..d9a3bd25295 100644 --- a/hardhat/common-contracts.js +++ b/hardhat/common-contracts.js @@ -22,12 +22,10 @@ task(TASK_TEST_SETUP_TEST_ENVIRONMENT).setAction((_, env, runSuper) => runSuper().then(() => Promise.all( Object.entries(INSTANCES).map(([name, { address, abi, bytecode }]) => - setCode(address, '0x' + bytecode.replace(/0x/, '')) - .then(() => env.ethers.getContractAt(abi, address)) - .then(instance => ({ [name]: instance })), + setCode(address, '0x' + bytecode.replace(/0x/, '')).then(() => + env.ethers.getContractAt(abi, address).then(instance => (env[name] = instance)), + ), ), - ) - .then(namedInstances => Object.assign(env, ...namedInstances)) - .then(() => {}), + ), ), );