From 7215bd1b1bee8184633b4594ca5fd7dd71f4fd86 Mon Sep 17 00:00:00 2001 From: Hadrien Croubois Date: Thu, 19 Dec 2024 16:29:21 +0100 Subject: [PATCH] simplify --- hardhat/common-contracts.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) 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(() => {}), + ), ), );