From 09aefc6e92888181195f0cf0c74133f065e0b318 Mon Sep 17 00:00:00 2001 From: Emre <72754835+0xemrekaya@users.noreply.github.com> Date: Wed, 21 Feb 2024 01:43:17 +0300 Subject: [PATCH] Update using-hardhat.md --- .../deploying-a-smart-contract/using-hardhat.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/build-on-mode/deploying-a-smart-contract/using-hardhat.md b/build-on-mode/deploying-a-smart-contract/using-hardhat.md index 0d8821b..17a6ed6 100644 --- a/build-on-mode/deploying-a-smart-contract/using-hardhat.md +++ b/build-on-mode/deploying-a-smart-contract/using-hardhat.md @@ -137,12 +137,14 @@ In the `scripts` directory, create a new file named `deploy.ts`: import { ethers } from "hardhat"; async function main() { - const HelloWorld = await ethers.getContractFactory("HelloWorld"); const gasPrice = ethers.utils.parseUnits('10', 'gwei'); // Adjust the '10' as needed const gasLimit = 500000; // Adjust this value based on your needs - const helloWorld = await HelloWorld.deploy({ gasPrice: gasPrice, gasLimit: gasLimit }); - await helloWorld.deployed(); - console.log("HelloWorld deployed to:", helloWorld.address); + const HelloWorld = await ethers.deployContract("HelloWorld", { + gasPrice: gasPrice, + gasLimit: gasLimit, + }); + await HelloWorld.waitForDeployment(); + console.log("HelloWorld deployed to:", HelloWorld.getAddress()); } main()