Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: deploy script missing(Create a Horoscope Web3 NFT Application) #445

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down