diff --git "a/Create a Horoscope Web3 NFT Application/1. \360\237\214\210 Getting Started!/3. Running your Hello World Smart Contract.md" "b/Create a Horoscope Web3 NFT Application/1. \360\237\214\210 Getting Started!/3. Running your Hello World Smart Contract.md" index bd6c11fb..9de2ec42 100755 --- "a/Create a Horoscope Web3 NFT Application/1. \360\237\214\210 Getting Started!/3. Running your Hello World Smart Contract.md" +++ "b/Create a Horoscope Web3 NFT Application/1. \360\237\214\210 Getting Started!/3. Running your Hello World Smart Contract.md" @@ -17,6 +17,38 @@ Before moving on, let’s update the Solidity version in the config file. We are ## Running your Hello World smart contract If you look at `contracts/Lock.sol`, you will see an existing solidity file that has a contract in it. Let’s try to run it using the following command in the terminal where you still are in your project directory in your terminal. +first paste below code to your project directory scripts folder(if not exist use `mkdir scripts` to create it) deploy.js file + +```js +const { + time, +} = require("@nomicfoundation/hardhat-toolbox/network-helpers"); +const { ethers } = require("hardhat"); + +async function main() { + const ONE_YEAR_IN_SECS = 365 * 24 * 60 * 60; + const ONE_GWEI = 1_000_000_000; + + const lockedAmount = ONE_GWEI; + const unlockTime = (await time.latest()) + ONE_YEAR_IN_SECS; + + const Lock = await ethers.getContractFactory("Lock"); + const lock = await Lock.deploy(unlockTime, { value: lockedAmount }); + + await lock.waitForDeployment() + console.log(`Lock with ${ONE_GWEI} and unlock timestamp ${unlockTime} deployed to ${await lock.getAddress()}`); +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error); + process.exit(1); + } + ); +``` + +then run below command ``` npx hardhat run scripts/deploy.js