Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

hello guys, I am trying to set up hardhat but it is proving difficult.

from the documentation, I am meant to do this:

image

I did that but nothing happens:

image

is there a way around this?

You must be logged in to vote

Replies: 2 comments

Comment options

Hey, if it got answered and fixed, please help, I'm getting some error in the same

TypeError: Cannot read properties of undefined (reading 'getContractFactory')
at main (file:///Users/utkarshmani/Desktop/Web3/hardhatone/scripts/deploy.ts:5:49)
at file:///Users/utkarshmani/Desktop/Web3/hardhatone/scripts/deploy.ts:22:1
stella›

import hre from "hardhat";

async function main() {
console.log("Getting SimpleStorage contract factory...");
const SimpleStorageFactory = await hre.ethers.getContractFactory("SimpleStorage");

// --- 4. Deploy the contract ---
console.log("Deploying SimpleStorage contract...");
const simpleStorage = await SimpleStorageFactory.deploy();

// Wait for deployment to be mined
await simpleStorage.waitForDeployment();

console.log(✅ SimpleStorage deployed at: ${await simpleStorage.getAddress()});

const storedValue = await simpleStorage.retrieve();
console.log("Retrieved value from contract:", storedValue.toString());
}

// Run the script
main().catch((error) => {
console.error(error);
process.exit(1);
});

You must be logged in to vote
0 replies
Comment options

which version of hardhat are you using? if you are using v3.0.6

It won't work. Delete you not modules, change the version to v2.26.3. make sure this this installed:

 @nomicfoundation/hardhat-toolbox 

(you can find other plugins here: https://v2.hardhat.org/hardhat-runner/plugins)

then do

import { ethers } from hardhat; 

read the documentation on how you can continue from there:

https://v2.hardhat.org/hardhat-runner/docs/getting-started#quick-start

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.