diff --git a/hardhat/scripts/deploy.js b/hardhat/scripts/deploy.js index 6e6ad6f8d5..14f72930fd 100644 --- a/hardhat/scripts/deploy.js +++ b/hardhat/scripts/deploy.js @@ -1,17 +1,18 @@ async function main() { - const [deployer] = await ethers.getSigners(); - console.log("Deploying contracts with the account:", deployer.address); - - const Token = await ethers.getContractFactory("Token"); - const token = await Token.deploy(); - - console.log("Token deployed to:", token.address); - } - - main() - .then(() => process.exit(0)) - .catch((error) => { - console.error(error); - process.exit(1); - }); - \ No newline at end of file + const [deployer] = await ethers.getSigners(); + console.log("Deploying contracts with the account:", deployer.address); + + const Token = await ethers.getContractFactory("Token"); + const token = await Token.deploy(); + + await token.deployed(); // Ensure the contract is deployed before accessing its address + + console.log("Token deployed to:", token.address); // This should print the correct address +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error); + process.exit(1); + });