Questions tagged [hardhat]

The tag has no usage guidance.

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

Does anyone know how to use TimeLockController.sol from openzeppelin

I want to use the openzeppelin timelock controller contract in a way that it calls the functions of other deployed contracts at some time. The thing can be done with the openzeppelin timelock ...
0
votes
0answers
5 views

TypeError: ethers.getContractFactory is not a function

Im trying to run the partybid contract https://github.com/PartyDAO/partybid from windows powershell but am running into this issue where getContractFactory is not a function Under helpers.js: const fs ...
0
votes
1answer
13 views

reverted with reason string 'Dai/insufficient-allowance' Testing

I am trying to test a simple function transferring Dai balance. test --> const [owner] = await ethers.getSigners(); const amount = await _hardhatPresaleERC20.calculateAmountTokensPurchased(1); ...
0
votes
1answer
14 views

I am running my tests in the hardhat environment but it gives me 0 passing all the time

I am facing rather unusual behavior from hardhat. I have written my test cases in a file inside test folder when i run yarn teston the terminal it gives me 0 passing. Don't have any idea as to why it ...
1
vote
0answers
16 views

Cannot interact with deployed contract - negative hex string

I am working on several contracts and I can deploy and test fine on hardhat-network. However whenever I switch to Ganache or Rinkeby I get the following behaviour: The contract deploys fine Whenever ...
0
votes
0answers
11 views

Fast forwarding time in hardhat testing?

My contract is calling a method on a different contract to track how the response changes. I am unit testing with a forking mainnet network in hardhat, which allows me to interact with that other ...
0
votes
0answers
9 views

Getting "Provider not found" while testing my contract with waffle

I am testing my contract using Waffle and I am following the documentation provided, using const provider = new MockProvider(); to get a provider for testing. An error was raised in expect().catch() ...
0
votes
1answer
37 views

Using Fork on Hardhat in testing

I am getting an error using a hardhat fork for testing. I run the forked node with "npx hardhat node --fork https://eth-mainnet.alchemyapi.io/v2/key --fork-block-number 13997235" I am able ...
1
vote
0answers
19 views

While writing a test using dapptools, how do I send a transaction as a specific wallet address?

I'm playing around with dapptools: dapp And I want to write a test that checks the gas for OpenZeppelin's ERC721 implementation of the transferFrom(..) function. Here's my test: // SPDX-License-...
0
votes
0answers
11 views

Programmatically configure hardhat network

I'm trying to programmatically configure the hardhat network (instead of specifying it in hardhat.config and using --network nname) before deploying a smart contract. So, something like this: import { ...
0
votes
1answer
25 views

Hardhat deploy on private chain with 0 fees

Using Hardhat, I am trying to deploy a contract on my private chain which has no gas fees. When doing the deploy, hardhat throughs a "insufficient funds" error ... I would like to override ...
0
votes
0answers
11 views

Hardhat Send Multiple Transactions

So this is a slimmed down version of the code I'm using. Error message in the terminal running the hardhat node is below. In the terminal I ran the command in it says the transaction timed out. If I ...
1
vote
2answers
67 views

Hardhat how to impersonate an account for a local fork without using etherjs

All tutorials show how to impersonate an account using hardhat and etherjs. In my case I create a local mainnet fork and run the tests and create TX using golang so interested to know how to ...
1
vote
0answers
26 views

Proper Local Hardhat Deploy and Transaction: function call to a non-contract account

I am trying to test out this contract function by function to interpret how each call works and while I am able to deploy the contract, I receive this error message, Error: Transaction reverted: ...
0
votes
0answers
35 views

Constantly getting insufficient funds for intrinsic transaction cost

Im trying to write some basic contract to the mainnet. On Ropsten everthing went smoothly but on mainnet i constantly getting the aforementioned error Im using the ETH guide on: https://ethereum.org/...
0
votes
0answers
14 views

Getting a weird compilation error in Hardhat (Possible Glitch)

Error: contracts/DappTest.sol:9:2: DeclarationError: Identifier already declared. import '@uniswap/v2-periphery/contracts/UniswapV2Router02.sol'; ^----------------------------------------------------...
0
votes
0answers
20 views

Displayinf error on payable in solc

This is my transaction file, to interact with the Eth blockchain, but it is showing me error in payable keyword in solc, can anyone help me with it, please // SPDX-License-Identifier: UNLICENSED ...
0
votes
1answer
12 views

Differences between .deploy() and deployed() methods

I am writing a js script that deploy my solidity contract. In the tuto, they use two methods .deploy() and .deployed() const main = async () => { const [owner, randomPerson] = await hre.ethers....
1
vote
1answer
63 views

how to hardhat test against a mainnet fork?

I'm using hardhat to fork the polygon mainnet by - npx hardhat node --fork <ALCHEMY RPC ENDPOINT> now i want to test on this local network. what is the command? npx hardhat test is not working.
0
votes
0answers
5 views

How do you get the Erc20 token balance of a random address using hardhat without the ABI json? [duplicate]

I need the dai balance of a whale which I am impersonating with hardhat.
2
votes
2answers
110 views

How to deploy a bytecode-only contract without an ABI

I see a contract's bytecode on chain that I want to re-deploy almost verbatim, but the issue is that there's no verification -- no ABI or source code. Can I still redeploy this contract to a hardhat ...
0
votes
1answer
39 views

How to test sending eth to function using ethers.js?

I'm net to eth dev and trying to test sending eth while assigning a value to betOnTeam function: function betOnTeam(uint8 _team) public payable { // assign usre to _team and add betting value to ...
1
vote
0answers
25 views

Programmatically get smart contract ABI and Bytecode

I have ERC20 contracts with imports and solc is not able to compile contracts with imports. I have tried truffle compile and it works fine and generates ABI. I want to fetch smart contract file ABI by ...
1
vote
1answer
45 views

Hardhat doesn't recognize functions

I have a simple contract: //SPDX-License-Identifier: Unlicensed pragma solidity 0.8.9; import '@openzeppelin/contracts-upgradeable/finance/VestingWalletUpgradeable.sol'; contract VestingWallet is ...
1
vote
1answer
57 views

I'm getting a polyscan parse error trying to verify my contract

Here's the lines: // SPDX-License-Identifier: MIT pragma solidity 0.8.11; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/...
0
votes
0answers
25 views

How do pass large number to deploy in hardhat?

This is the error I get: Error: overflow (fault="overflow", operation="BigNumber.from", value=3.96e+26, code=NUMERIC_FAULT, version=bignumber/5.5.0) at Logger.makeError (/home/...
1
vote
0answers
38 views

Read from a testnet Rinkeby contract with hardhat script

I am trying to read state variables (using hardhat scripts) from a contract deployed on the Rinkeby network. I use the script below but it returns 'undefined' as if it can't read from the contract. ...
1
vote
0answers
84 views

Hardhat testing on testnet (Rinkeby)

I want to do some final tests on a smart contract that has been deployed on the Rinkeby testnet. I am trying to run the below script (saved in my hardhat test folder) with hardhat but get the ...
1
vote
0answers
16 views

I can't figure out how to get hard hat working in VSCode

I installed version 8.3.0 of hardhat vis the terminal, but when I type npx hardhat to create a new file, it just brings up a list of global and available options. Additionally, hardhat has not created ...
1
vote
1answer
101 views

How to deploy gnosis safe contracts on multichain

I am trying to fork gnosis safe react and contract repository. I have successfully set up gnosis safe react and contracts locally. I just want to know that how can I deploy its contracts by using my ...
0
votes
1answer
28 views

How to deploy string variable of solidly code in hardhat

In order to deploy a contract, we fetch the smart contract file with hardhat and then deploy it: const Token = await ethers.getContractFactory("Token"); const hardhatToken = await Token....
0
votes
0answers
8 views

Solidity array pushing elements on same index like this: "0": "string[]: visit mummy,visit papa"

I'm a beginner and making a simple TODO list contract, I made a function addTasks that pushes elements in string array. But when I'm returning the array, it shows elements in same index. like this &...
0
votes
1answer
76 views

Invalid Chai property when testing smart contract

In a hardhat project I'm using smock to mock an ERC20 contract and chai's calledOnce to assert: const {expect} = require("chai") const {artifacts, ethers} = require("hardhat&...
0
votes
1answer
106 views

Debug hardhat project using intellij

I've created an hardhat project that uses typescript. As I'm trying to run the test from intellij I'm getting: TSError: ⨯ Unable to compile TypeScript: test/index.ts(2,10): error TS2305: Module '"...
0
votes
0answers
12 views

Correct way to write an upgradeable proxy contract with implementation logic [duplicate]

When I create an Upgradeable contract, do I include all the variables and functions pertaining to my logic directly in the proxy contract? I'm a little confused on where to put all my logic because ...
0
votes
0answers
40 views

I can't verify the contract on bscscan, I have installed Openzepplin. This is [HardHat] (Pictures add in)

Showing you first the deployed contract, smart contract, and then the error on the last picture. I have tried to deploy it with the URL but the problem remained. I myself know that there's an easy ...
1
vote
0answers
113 views

Missing artifacts for openzeppelin contracts with hardhat

I'm using hardhat to write a dapp. As I'm compiling my dapp I'm getting an error: Error HH700: Artifact for contract "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:...
1
vote
1answer
24 views

contract factory function causes contract to exceed size limit

I'm writing a smart contract where one of the functions deploys a payment splitter contract that inherits from OZ PaymentSplitter.sol. I'm doing something like: function splitterFactory(address[] ...
0
votes
0answers
12 views

Deployed the contract to the testnet -- now the question. Why can't i verify it? I have installed Openzeppelin [Hardhat] Add-in pictures

I have just been able to deploy the contract to the testnet but what has happened is that I can't verify it for some reason. I have installed Openzeppelin but the problem has remained. Any advice on ...
0
votes
1answer
18 views

I've just created a contract, But the question that remains, how do i put in the total supplys of tokens into the contract? [Hardhat, Openzeppelin]

I have just been able to deploy the contract into the testnet but as a beforehand noticed, there are no total tokens of Nikola being deployed. Could someone advise me on what I should do to redeploy ...
0
votes
0answers
11 views

TypeError: Nikola.depoly is not a function -- Seconds from deploying my contract. Gettings this error - Picture add-in

after fixing the last issue, I got into this issue. Would appreciate any support I get. Will upload a course on Coursera soon about hardhat and cryptocurrency projects, so any help I get will support ...
0
votes
1answer
193 views

reason: 'too many arguments: in Contract constructor', This is the last step before i deploy the contract, so any advice would be great

I got this error: Is there some error I have been making in the contract? Any help would I appreciate, if you need me to publish other contracts just tell me I will update this question with the ...
0
votes
1answer
57 views

ParserError: Expected ';' but got identifier Error HH600: Compilation failed - getting this error, one step before deploying the contract

I keep getting this error; I was told before to use "const License one in my code, but I don't know which contract I will put it into. Here's the picture: Could someone advise me on what I should ...
0
votes
2answers
92 views

ERC20 allowance is 0 even after approval

I’m getting 0 allowances even after approving admin to spend, although msg.sender has a balance of 100. I tried to sleep for 10 seconds too before executing transferFrom() it fails and even after that ...
0
votes
0answers
166 views

Hardhat is not generating private keys when I run `npx hardhat node`

I don't know what is the problem here. When I run npx hardhat node I am getting only public keys. And this is my hardhat.config.ts configuration: import "@nomiclabs/hardhat-waffle"; import &...
0
votes
1answer
47 views

What is the difference betweeen getSigners() eth accounts and the eth account in .env?

I am currently learning the usage of the Hardhat deployment environment and I have some questions with regards to getSigners() I understand that getSigners() is an abstraction of an eth acc to be used ...
1
vote
2answers
552 views

HardhatError: HH700: Artifact for contract "Greeter" not found - clarification [Hardhat, openzeppelin]

I keep getting this error when doing: npx hardhat run scripts/sample-script.js --network testnet. I got an answer "You have named your contract 'Nikola' and not 'Greeter'. The actual file-names ...
1
vote
1answer
406 views

An unexpected error occurred: Error: Cannot find module '@nomiclabs/hardhat-waffle' [Hardhat, openzeppelin]

I keep getting this error when doing: npx hardhat run scripts/sample-script.js --network testnet. Edited the name of my computer for security reasons. How do I put in the module 'nomiclabs/hardhat-...
2
votes
1answer
321 views

HardhatError: HH700: Artifact for contract "Greeter" not found - this is the problem i'm getting [Hardhat, openzeppelin]

I keep getting this error when doing: npx hardhat run scripts/sample-script.js --network testnet. Edited the name of my computer for security reasons. Compiling 10 files with 0.8.4 Compilation ...
0
votes
0answers
50 views

Trying to deploy my smart contract to ropsten testnet but keep receiving this error - ReferenceError: Secret is not defined

The last one is Hardhat.config.js This the error (sensitive information, meta mask private key blurred and so the moralis io testnet code ReferenceError: Secret is not defined at Object. (/Users/...

1
2 3 4 5 6