Skip to content

Commit 2e55292

Browse files
Update deploy.js
1 parent 1b42a04 commit 2e55292

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

hardhat/scripts/deploy.js

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
async function main() {
2-
const [deployer] = await ethers.getSigners();
3-
console.log("Deploying contracts with the account:", deployer.address);
4-
5-
const Token = await ethers.getContractFactory("Token");
6-
const token = await Token.deploy();
7-
8-
console.log("Token deployed to:", token.address);
9-
}
10-
11-
main()
12-
.then(() => process.exit(0))
13-
.catch((error) => {
14-
console.error(error);
15-
process.exit(1);
16-
});
17-
2+
const [deployer] = await ethers.getSigners();
3+
console.log("Deploying contracts with the account:", deployer.address);
4+
5+
const Token = await ethers.getContractFactory("Token");
6+
const token = await Token.deploy();
7+
8+
await token.deployed(); // Ensure the contract is deployed before accessing its address
9+
10+
console.log("Token deployed to:", token.address); // This should print the correct address
11+
}
12+
13+
main()
14+
.then(() => process.exit(0))
15+
.catch((error) => {
16+
console.error(error);
17+
process.exit(1);
18+
});

0 commit comments

Comments
 (0)