0

I'm trying to get the address of a deployed contract, but I'm getting undefined. This is how I'm deploying:

const Init = await hre.ethers.getContractFactory("InitUpgradeV2");
const init = await Init.deploy(); 
await init.waitForDeployment();
console.log('Init deployed to: ', init.address); //undefined

This is my hardhat.config:

require("@nomicfoundation/hardhat-toolbox");
require('dotenv').config();


module.exports = {
  solidity: "0.8.21",
  networks: {
    hardhat: {
      forking: {
        url: process.env.ARBITRUM,
        blockNumber: 136177703
      }
    }
  }
};

I've tried adding a defaultNetwork, removing the working and running on hardhat's network, specifying the network when deploying in the console npx hardhat run script/deploy.js --network hardhat, but same result.

You used to be able to do await init.deployed() but it seems that's no longer a function.

Thanks a lot!

1 Answer 1

0

Now, to get the address of the contract, you don't do init.address, but init.target.

"ethers": "^6.7.1",
"hardhat": "^2.17.4"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.