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!