From 2e552925b0736c17bdabb4ed4f742b237d5401f6 Mon Sep 17 00:00:00 2001 From: nikolaivanovj <110764167+nikolaivanovj@users.noreply.github.com> Date: Mon, 6 Jan 2025 23:58:35 +0200 Subject: [PATCH] Update deploy.js --- hardhat/scripts/deploy.js | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) 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); + });