Questions tagged [hardhat]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
3 views

Transaction reverted: function returned an unexpected amount of data when requesting Institution Data

I am trying to request for Institution details which returns two or more data but getting these error. Error: Transaction reverted: function returned an unexpected amount of data at Institution....
Nikhil Raj's user avatar
0 votes
0 answers
19 views

Want to transfer erc20 token from one account to another using meta transaction with help of erc2771

I want to transfer erc20 token from one account to another using meta transaction with help of erc2771. I am using openzeppelin/contracts verison 5.0.1 I have two contracts MyToken - it inherit ...
Jasmeen Maradeeya's user avatar
1 vote
1 answer
38 views

Everything works perfectly when testing a contract, but fails when a website interacts with the it

I try to deploy a contract to my local hardhat node and to interact with it via my website. The problem is that i tested my function using hardhat tests and everything worked perfectly. But then when ...
andr0-0's user avatar
  • 57
0 votes
0 answers
15 views

Cannot read properties of undefined (reading 'deployContract')

const hre = require("hardhat"); async function main() { const userstorage = await hre.ethers.deployContract("userstorage"); await userstorage.waitForDeployment(); console....
Achal Jhawar's user avatar
0 votes
1 answer
38 views

Error: contract runner does not support sending transactions (operation="sendTransaction", code=UNSUPPORTED_OPERATION, version=6.11.1) [duplicate]

Error: contract runner does not support sending transactions (operation="sendTransaction", code=UNSUPPORTED_OPERATION, version=6.11.1) i got this error what should i do ?
Thejeshwar's user avatar
0 votes
1 answer
17 views

Contract compilation problem with hardhat

hello I'm trying to compile a contract with hardhat but I get the following error HH409:Trying to import @openzeppelin/contracts/access/ownable.sol from contracts/SimpleStorage.sol, but it has an ...
Devop86's user avatar
1 vote
0 answers
16 views

Issues setting up a test case for when withdrawal fails in my Contract

Question Description: I created a contract that users can fund and only the owner of the Contract can withdraw the funds from the Contract. The Contract is below: // SPDX-License-Identifier: MIT ...
Eyang Daniel's user avatar
1 vote
1 answer
17 views

Getting error when trying to get Transaction Events Logs

I am trying to check whether an event is emitted or not in my unit test. But getting error as length undefined. The error I am getting is TypeError: Cannot read properties of undefined (reading '0') ...
Nikhil Raj's user avatar
0 votes
0 answers
6 views

How to trigger revert with hardhat

I want to use hardhat to test my contract.Here is my Contract. When I deliberately make a mistake which will trigger require(,"The service is not passed") and run npx hardhat test,I expect ...
hiahia xu's user avatar
0 votes
1 answer
20 views

Does Integration-Testing can be down in local blockchain using Hardhat?

I'm currently working on a project where I need to perform integration testing involving a third-party contract. This contract is part of a library that I've included in my project as a git submodule ...
codekoriko's user avatar
0 votes
0 answers
9 views

How to use contract address in web3js dynamicly with hardhat?

I have an contract but when I deploy with hardhat in artifact json code there s no contract address property but with truffle there was. I wanna use hardhat and use contract address not staticly ...
seojunchian's user avatar
1 vote
1 answer
21 views

Listening to events in unit test using Viem

I want to be able to tell how many approval event were sent during my test as I cannot tell how many where sent since they are auto-approved by hardhat Running Environment.
codekoriko's user avatar
0 votes
0 answers
16 views

Equivalent of hardhat local node in golang

I would like to know if Golang has any tools like Hardhat to simulate blockchain's environment/local node with persisting state. I want to create an app that for a given wallet and token address ...
Kacper's user avatar
  • 1
2 votes
2 answers
47 views

I'm unable to sendTransaction using Ethers@^6.10.0

I'm currently trying to set up a script that sends Ethereum from one account to another. Using the hardhat framework, I provided the sender's private key from the local node and the receiver address. ...
Eyang Daniel's user avatar
2 votes
0 answers
64 views
+50

How to mock smart contract with hardhat and ethers v6

I found here 2 ways to mock Smart contract but they all limited to ethers.js v5: @nomiclabs/hardhat-waffle @defi-wonderland/smock Today hardhat-toolbox is at version 4 and migrated away from hardhat-...
codekoriko's user avatar
0 votes
0 answers
15 views

Error in plugin solidity-coverage: TypeError: Cannot read properties of undefined (reading 'match')

when running yarn hardhat coverage, it compiled the solidity files successfully and then gave the following error message: Error in plugin solidity-coverage: TypeError: Cannot read properties of ...
Liron Achdut's user avatar
0 votes
1 answer
21 views

Deploying Multiple Contracts at the same address using hardhat

Consider I have two contracts A & B. B inherits A. Now i want to deploy using hardhat and at the same address. How can i do? Example of what i want to do, but since in the new hardhat version ...
Anish Singh's user avatar
1 vote
2 answers
121 views

TypeError: invalid BytesLike value (argument="value", value=[ ], code=INVALID_ARGUMENT, version=6.10.0) in testing Raffle Contract

While testing the Raffle contract, I am getting error in the line written "await network.provider.send("evm_increaseTime", [Number(interval) + 1]); await network.provider.send("...
Nikhil Raj's user avatar
1 vote
0 answers
14 views

which fork debugger to use?

what tool are you using to debug mainnet contracts. So doing a fork and be able to step into line by line (considering you have the source ofcourse), but doing it on live contract. I tried to use ...
Josip's user avatar
  • 53
0 votes
0 answers
14 views

Why doesn't `transfer` method change balance?

I have a smart contract to deal with payment as below code: // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.9; import "hardhat/console.sol"; contract PaymentChannel { ...
Joey Yi Zhao's user avatar
1 vote
0 answers
56 views

Hardhat throw Error: yParity mismatch (argument="signature", ...... ) when i try to deploy smartcotnract in sepolia testnet

Command passed: npx hardhat run scripts/deploy.js --network sepolia Hardhat throw error when i try to deploy smart contract in sepolia test using alchemy api: TypeError: yParity mismatch (argument=&...
Ethereum Developer's user avatar
0 votes
1 answer
53 views

No arguments passed to the base constructor. Specify the arguments or mark contract as abstract

I'm importing ownable contract from Openzepplin . The contract look like this : // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {Ownable} from "@openzeppelin/contracts/access/...
MD AZAD's user avatar
  • 35
0 votes
0 answers
37 views

EE TypeError: invalid type (argument="type", value="myEnumName", code=INVALID_ARGUMENT, version=6.10.0)

Error occurs during library deployment if I have an enum in function arguments, including structs that have enums. Why does this error happen, and how can I fix it without changing enums to uint8? ...
Gleb Protasov's user avatar
0 votes
1 answer
22 views

TypeError: GetNamedAccounts is not a function

This error: TypeError: GetNamedAccounts is not a function gets printed when i try to deploy my contract with this piece of code: yarn hardhat deploy --network sepolia I've tinkered with dependencies ...
andr0-0's user avatar
  • 57
0 votes
0 answers
19 views

Ethers get contract errors as hex (unrecognized error) instead of the proper error name. Hardhat testing

I am testing this contract, and I ran into the problem that when a function returns a revert, whether custom or not, ethers cannot decipher the error, instead it shows me that the contract could not ...
Facundo Moreno's user avatar
0 votes
0 answers
17 views

Issue with Retrieving Contract Address After Deployment in Hardhat

Description: I'm encountering an issue while attempting to retrieve the contract address after deployment using Hardhat with ethers v6. Below is a summary of my setup: roject Name: hardhat-simple-...
Amine Merad's user avatar
0 votes
0 answers
7 views

Is it possible to verify that an event is not emitted in Hardhat tests?

I know that it's possible to check for emitted events in a call in Hardhat using .to.emit method. Is there a way to make sure that an event should not be emitted in a call? For example I may want to ...
mahdi's user avatar
  • 178
0 votes
1 answer
387 views

Instead change the require of chai.js in to a dynamic import() which is available in all CommonJS modules

.js file const { expect } = require('chai'); describe("Token contract",function(){ it("Deployment should assign the total supply of the owner", async function(){ const[owner] =...
Vaibhav_01's user avatar
0 votes
0 answers
16 views

TypeError: Cannot read properties of undefined (reading 'map') Hardhat

when i try to run this code use npx hardhat test in terminal give me output TypeError: Cannot read properties of undefined (reading 'map') this is my code file Escrow.js const { expect } = require(&...
Royhan Nulloh's user avatar
0 votes
0 answers
8 views

inspect local vars in fork?

Trying to find a way to inspect local variables during method call when having failed tx. Is there a way to example fork mainnet with hardhat and then to have insight on used local variables when ...
Josip's user avatar
  • 53
0 votes
0 answers
29 views

Blockscout Hardhat "Unable to find a block containing transaction"

I had Hardhat node running and then started up Blockscout from docker-compose (hardhat-network.yml) and all seemed to be ok. I made some config changes to hardhat as I'm attempting to verify contracts ...
HankCa's user avatar
  • 155
0 votes
0 answers
14 views

Declaration "ERC721" not found in "c:/Users/

//SPDX-License-Identifier: Unlicense pragma solidity >=0.8.0; import {ERC721} from "@openzeppelin/contracts/utils/Counters.sol"; // i get error in this line import {ERC721} from "@...
Royhan Nulloh's user avatar
0 votes
1 answer
37 views

Error when using hardhat but changes made successfully onto smart contract, was able to see changes on etherscan

const [signer] = await ethers.getSigners(); const contractAddress = 'address...'; const contractABI = ["abi..."]; const existingContract = new ethers.Contract(contractAddress, contractABI,...
kzb's user avatar
  • 1
0 votes
1 answer
16 views

Wrong network at the transaction

I transfered 1000 usdt to ethereum network mistakenly from bnb network and i lost them. Can you help me with the solution to recover them please? i transfered them from binance to revolut
konstantinos's user avatar
0 votes
0 answers
61 views

Why is hardhat contract deployment script consuming high gas?

const hre = require("hardhat"); async function main(file_name, private_key, smart_contract_name, smart_contract_symbol) { const networkURL = hre.network.config.url; const provider = new ...
Gaurav Pant's user avatar
0 votes
0 answers
17 views

Error: cannot estimate gas; transaction may fail or may require manual gas limit,reason="execution reverted"

$ yarn hardhat run scripts/mockOffChain.js --network goerli yarn run v1.22.19 warning package.json: No license field $ '/home/rajvir_singh/FCC Full stack Web3 course/Hardhat Lottery L9/node_modules/....
Rajvir Singh's user avatar
0 votes
1 answer
89 views

"ProviderError: execution reverted" I get this error when trying to deploy to Sepolia

I need a bit of help with my code here. Maybe someone more experienced can eye the bug, I've have to give up and ask here. So, I am trying to deploy to Sepolia and I am getting this error and I've ...
mhanga's user avatar
  • 1
0 votes
0 answers
52 views

Error HH19: Your project is an ESM project (I already tried to changed chai from ^5.0.0 to ^4.3.7 but still failed)

When I tried to npx hardhat compile, error HH19 showed up I already changed the chai from ^5.0.0 to ^4.3.7 and changed the file name from js to cjs, and the error still shows up. Any ideas on how to ...
aoki's user avatar
  • 1
1 vote
0 answers
12 views

Why Balance in Aurora shows like 0 in WETH?

Have a question about my wallet balance Check Function in hardhat script. It's always seeing like 0 but it's not. My function: let config,arb,owner; const network = hre.network.name; if (network === '...
Pavel Konchych's user avatar
0 votes
1 answer
38 views

Hardhat error installing nomiclabs/hardhat-waffle

npm install -D @nomiclabs/hardhat-waffle ethereum-waffle npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: undefined@undefined npm ERR! Found: [email protected] ...
anonauditor's user avatar
0 votes
2 answers
78 views

Why is my contract not deploying on the Sepolia testnet? It shows that the Sepolia network doesn't exist

am encountering an issue with deploying my contract on Hardhat. The error message indicates that the Sepolia network does not exist. I have provided links to screenshots of the error messages for ...
Bahloul mubarik's user avatar
0 votes
0 answers
9 views

Calling a function inside a contract using hardhat deploy scripts

I'm writing a dice betting game which uses Chainlink VRF V2 to get random numbers for the dices. I'm trying to deploy the VRF V2 Mock and then create a subscription and add My currently deployed ...
Rjey's user avatar
  • 17
0 votes
1 answer
38 views

Cannot read properties of undefined (reading 'checkUpkeep')

mockOffChain.js const { ethers, network } = require("hardhat") async function mockKeepers() { // const raffle = await ethers.getContractAt("Raffle") const contractAddress =...
Rajvir Singh's user avatar
0 votes
1 answer
445 views

Error HH19: Your project is an ESM project (you have "type": "module" set in your package.json) but your Hardhat config file uses the .js extension

Error: Error HH19: Your project is an ESM project (you have "type": "module" set in your package.json) but your Hardhat config file uses the .js extension. Rename the file to use ...
Plair's user avatar
  • 21
0 votes
1 answer
31 views

Unable to connect ganache with Hardhat

I am not being able to connect hardhat to the local ganache network. I have already connected the ganache to the metamask. Here is my hardhat.config.js code: /** @type import('hardhat/config')....
imbot's user avatar
  • 11
0 votes
1 answer
17 views

Facing Issue with test files in Hardhat

I am trying to build a Dapp with hardhat installed in my vs Code my smart contracts parts are over and it gets compiled but I am facing a problem with test files I don't know why they are not getting ...
Abhik Chanda's user avatar
1 vote
0 answers
17 views

Building a Hardhat Project in an AWS EC2 Debian Box, Vyper Compiler Error

Everything is working, solidity contracts compile. But I want to use Vyper; I love vyper, because Vitalik Buterin made it and it has such beautiful simplicity. For some reason I cannot get hardhats ...
Jack Vafi's user avatar
1 vote
2 answers
27 views

Problem verify smart contract by harhdat

I recently used hardhat as a compiler for deploying SC and feel it really efficient. However, when I try to verify the SC using npx hardhat verify --network bsc_testnet 0x.... I got the following ...
Xar Tran's user avatar
0 votes
2 answers
24 views

problem with reverted when testing smart contract

In my smart contract there is a function: function fund() public payable { require( msg.value.getConversionRate(priceFeed) >= MINIMUM_USD, "You need to spend more ETH!"...
vinh nguyen's user avatar
2 votes
1 answer
52 views

TypeError in Hardhat-Chai Matchers - isAddress not a function

I'm encountering a TypeError in my Hardhat test script that involves the isAddress function from the @nomicfoundation/hardhat-chai-matchers library. The error seems to be causing issues with my test ...
Aung's user avatar
  • 21

1
2 3 4 5
27