New answers tagged hardhat
0
votes
hardhat-shorthand is not working
you can add yarn bin in PATH:
yarn global dir # get yarn bin path
0
votes
Hardhat Chai expect to.be.reverted fails on reversion
When you are expecting a revert, you should put the await before expect.
Instead of:
expect(await ERC20Contract.connect(user2).mint(user1.address, USERS_MINT)).to.be.reverted;
There should be:
await ...
1
vote
Is it possible to run a validator node on a forked net?
Yes, it's possible to fork the Ethereum mainnet using Hardhat and set up a validator node on the fork for testing purposes on a website.
This allows experimentation before deploying on the testnet. ...
0
votes
contract.deploymentTransection.wait(1) not working in ethers version 6.4.0
await simpleStorage.deploymentTransaction().wait(3);
Note that deploymentTransaction is a function call, it requires the round parenthesis.
0
votes
typeError: Cannot read properties of undefined (reading 'format')
TypeError: Cannot read properties of undefined (reading 'format')
the variables are either undefined or not formatted proparly for the function to interpret the arguments.
I think the problem either ...
0
votes
I am trying to display image on frontend using pinata and ipfs but facing this error
From the error it sounds like its more related to display(address) but let us know if you need more assistance with the upload part! We have some React examples here as well as an Next.js Template you ...
0
votes
Error: factory runner does not support sending transactions DEPLOYMENT
In hardhat.config.js, you should use accounts instead of account
require("@nomicfoundation/hardhat-toolbox");
require("dotenv").config();
const { INFURA_API_KEY, ...
0
votes
Hardhat says it deployed contract to 0x5FbDB2315678afecb367f032d93F642f64180aa3?
I was getting the same error with:
npx run scripts/deploy.js --network sepolia.
I forgot to add the hardhat command in. It should be:
npx hardhat run scripts/deploy.js --network sepolia
0
votes
hardhat node problem
Using plain old hex values instead of abi encoded uint256 values solved this for me. ie 0x2 instead of 0x0000000000000000000000000000000000000000000000000000000000000002.
0
votes
ParseEther is getting undefined
If you are using ethers version 6 then you have to remove utils. you can directly use
ethers.parseEther("")
instead of ethers.utils.parseEther()
0
votes
Error: factory runner does not support sending transactions (operation="sendTransaction", code=UNSUPPORTED_OPERATION, version=6.7.1)
Your hardhat.config.js:
accounts: [`0x${PRIVATE_KEY}`],
plural 'accounts', not singular 'account'
2
votes
0
votes
how to test all funds are withdrawn from a contract with hard hat
You can calculate the transaction gas fee.
const balance = await ethers.provider.getBalance(owner.address); // owner balance
const amount = await ethers.provider.getBalance(greeter.target); // ...
1
vote
Cannot read properties of null (reading 'constructor') Etherjs error
Just change in the second line to const contract = new ethers.Contract so you'll call class constructor.
And no need in await on second line as constructor in synchronous
0
votes
Accepted
Failing to deploy any Contract
I reinstalled the whole project folder - this led the compiler to accept certain changes which it didnt accept before (most notable change was the addition of constructor arguments for Ownable.sol)
...
0
votes
How do I obtain a signer object from a named account address in a Hardhat project?
To obtain a signer object from a named account address in a Hardhat project with the hardhat-deploy plugin, you can use the ethers.getSigner method, which is designed to work with the addresses of the ...
0
votes
Exception When Calling Function In a Library that Returns an Array
if you are using a dynamic array then instead of assigning the index, just push into the array.
pragma solidity ^0.8.4;
library LibA {
function getArray() public pure returns (uint[] memory) {
...
-1
votes
Problem with using OpenZeppeling contracts with Hard Hat - not found: File import callback not supported
There is a little bit difference between importing the code in solidity and hardhat code
Solidity code
import "@openzeppelin/contracts/ownership/Ownable.sol";
hardhat code
import "@...
0
votes
Accepted
How to run the hardhat fork in the separate terminal?
In a terminal you can do this:
npx hardhat node --fork http://arb-mainnet.g.alchemy.com/v2/<key>
It should open a network, leave it open until you finish testing everything.
Then you can run ...
1
vote
Hardhat - HardhatEthersProvider.resolveName is not implemented
You are calling constructor on wrong way.
constructor(
address _lzEndpoint,
string memory _name,
string memory _symbol,
uint8 decimal
) OFTWithFee(_name, _symbol, ...
1
vote
Error HH8: There's one or more errors in your config file: * Invalid account: #0 for network: sepolia - private key too short, expected 32 bytes
sepolia: {
url: `${process.env.API_URL}`,
accounts: [`0x${process.env.PRIVATE_KEY}`], //No need to concatenate '0x"
}
The issue is from the configuration above. Firstly, there's no need to ...
Top 50 recent answers are included
Related Tags
hardhat × 1295solidity × 603
ethers.js × 325
hardhat-deploy × 198
testing × 149
javascript × 84
contract-deployment × 76
chai × 67
contract-development × 58
blockchain × 49
openzeppelin × 49
unittesting × 44
web3js × 43
test × 43
erc-20 × 40
uniswap × 40
typescript × 38
ether × 36
nft × 33
mocha × 33
etherscan × 32
metamask × 31
react × 29
chainlink × 29
nodejs × 26