Questions tagged [hardhat-deploy]

The tag has no usage guidance.

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

Metamask doesn't connect to it's own localhost or hardhat localhost

Metamask doesn't connect to it's own localhost. I run a hardhat node from Mac. I know it's a known issue, but I've tried all available methods listed below. I tried installing older versions of ...
user avatar
0 votes
1 answer
29 views

how to use a library with testcases using hardhat

I'm using a library for managing Events. Now when I'm running the test case script then I'm getting an error. ERROR If I don't mention the library when I'm deploying the Users.sol contract. ...
user avatar
  • 212
0 votes
2 answers
26 views

Sending ERC20s to a Contract on deployment

I'm trying to send an amount of ERC20 on Contract deploy to the contract itself. I'm using Hardhat and OpenZeppelin Contracts. Contract Code: //SPDX-License-Identifier: Unlicense pragma solidity ^0.8....
user avatar
0 votes
1 answer
44 views

I keep getting this error while trying to compile my contract trough the HardHat feature

Here is the script in my deploy.js: const main = async () => { // We get the contract to deploy const Transactions = await hre.ethers.getContractFactory("Transactions"); const ...
user avatar
0 votes
1 answer
63 views

Set deployer address in Hardhat tests

I am using HardHat to write some unit tests. This part is related to deploying the contract, though I am not seeing how hardhat set address of deployer here. Say we have these addresses: let user1: ...
user avatar
  • 105
0 votes
0 answers
37 views

understanding hardhat JSON-RPC url - when is it used by DAPP?

I have a react.js app running using Portis wallet and I deployed one of my smart contracts using hardhat, using the url obtained from pokt.network and the other from default public url: https://rpc....
user avatar
  • 62
0 votes
1 answer
67 views

Deploying multiple contracts using Hardhat

My two contracts look something like this: contract ContractA { ContractB public contractB; constructor() { contractB = new ContractB(address(this)); } } contract ...
user avatar
0 votes
2 answers
147 views

how to deploy smart contract using hardhat via specific signer/owner

I am trying to deploy a contract as per documentation https://hardhat.org/guides/deploying.html#deploying-your-contracts Below is how i am deploying it hardhat.config.js require("@nomiclabs/...
user avatar
0 votes
1 answer
59 views

Deploy contract using second address in wallet using hardhat

I'm trying to deploy a contract using the second address in my wallet (Metamask), how can I achieve such thing from hardhat? This is my hardhat config: /** * @type import('hardhat/config')....
user avatar
0 votes
0 answers
16 views

Can't set the value of a variable when passing encoded data as parameter with upgradeable contracts

I posted many days ago and I thought to have understood the answers but apparently here I am asking the same questions again! I have these contracts: // SPDX-License-Identifier: MIT pragma solidity ^0....
user avatar
0 votes
0 answers
13 views

How to have a URL(backed by a host provider) for a Dapp

I have created a Dapp by React, Ethers.js, and Hardhat, but I don't know how to make it available to the public? I know I must deploy it to some mainnet or testnets, instead of local servers. But the ...
user avatar
0 votes
0 answers
17 views

Does hardhat have an equivalent to map.json in brownie?

In brownie projects, the last deployed contracts are stored in build/deployments/map.json. Does Hardhat have something similar? Example map.json: { "42": { "DappToken": [ ...
user avatar
1 vote
1 answer
144 views

Hardhat gives a same address for every deployment on the localhost

I am trying to develop my project using React, Ethers, and Hardhat. Whenever I run the below commands in order, the hardhat gives me the same address as previously deployed contracts. So weird! I ...
user avatar
0 votes
1 answer
35 views

How to send ethers to a contract during its deployment in hardhat? [duplicate]

Let's say I have this contract. contract Wallet{ string value; function balance() public view returns(uint){ return address(this).balance; } constructor(string memory _value) ...
user avatar
0 votes
1 answer
192 views

Reverted with reason string 'ERC20: insufficient allowance'

I'm newbie on solidity and I'm trying a simple ERC20 on hardhat with task for understand use case I follow this steps Mint in owner Owner owns N token Owner would to approve Receiver for receive ...
user avatar
2 votes
0 answers
69 views

Save hardhat node state for later

Is there a way to save your current local hardhat node state for later? Or do you have to restart every time you start up a new node? Like: yarn hardhat node --from-state ./state-dir Or something
user avatar
0 votes
1 answer
133 views

How to re-use previously deployed contract with Hardhat?

In brownie there's a very handy syntax to avoid deploying multiple times the same contract on-chain, while developing and iterating fast: MyContract.deploy() # somewhere else, sometime later: ...
user avatar
0 votes
1 answer
117 views

Quickswap transaction always reverts when using swapExactTokensForTokens

pragma solidity 0.7.5; import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; contract Swap { ...
user avatar
0 votes
0 answers
190 views

Using "hardhat deploy" plugin, and it is not getting the deployed contracts

I'm using the hardhat-deploy plugin to deploy the contracts, the plugin successfully deployed the two contracts but, not performing the same this time, what I've done is... import { ...
user avatar
0 votes
1 answer
19 views

Is Transaction fees refund when deploy smart contract fail

I deployed a smart contract using hardhat to Ethereum mainnet, so the transaction fail, and my question is Transaction fee will be refunded to my wallet or not? Thanks.
user avatar
0 votes
0 answers
55 views

problems deploying a contract on the Kovan network

Good evening, a couple of days ago I was able to execute this command without any problem and today, suddenly, I got this error. I don't understand what it means by "insufficient funds". ...
user avatar
  • 141
1 vote
0 answers
129 views

ByteCode produced by hardhat compilation incompatible with ethers.js factory methods?

I've been trying to deploy a contract with ethers.js using the artifacts produced by hardhat compile, but it fails on factory creation with an "invalid bytecode" error, because the json ...
user avatar
  • 407
2 votes
1 answer
283 views

hardhat-deploy deterministic deployment

I'm trying to deploy a contract, delete it, and then deploy it again using CREATE2 with hardhat-deploy's deterministic feature. However, I can't seem to get my contracts to have the same address. Here ...
user avatar
0 votes
0 answers
119 views

Can't deploy smart contract to hardhat network

I set up a project with hardhat for an NFT app. I modify hardhat.config.js like this: const { ALCHEMY_KEY, ACCOUNT_PRIVATE_KEY } = process.env; module.exports = { solidity: "0.8.0", ...
user avatar
0 votes
3 answers
162 views

NPX hardhat compile failing

I am following the OpenZeppelin docs for deploying a smart contract. but when i run npx hardhat compile i get this error ParserError: Source "node_modules/@openzeppelin/contracts/access/Ownable....
user avatar
0 votes
2 answers
257 views

Call A Smart Contract Function With Another Deployed Smart Contract Address As "msg.sender " From Hardhat Test

I have The Following Function in my Smart Contract function functionName(uint256 param1, address param2) external override { require(msg.sender == marketContract, "...
user avatar
0 votes
0 answers
121 views

Problem when deploying a contract to the rinkeby network

I encountered the following problem when deploying a contract to the network (everything is successfully deployed to the local network) details hardhat.config on the picture. Problem: ProviderError: ...
user avatar
0 votes
2 answers
228 views

How to test if msg.value is 1 ether in test

I have a function which mints when 1 eth is send to it. The function is function _mint() public payable{ require(msg.value == 1 ether , "Send more ethers: 1 ether is required"...
user avatar
  • 51
0 votes
0 answers
9 views

Access returned contract reference with ethers.js [duplicate]

Say I have the following contracts: contract A { constructor(string memory name) { m_name = name; } function getName() public view returns(string) { return m_name; } ...
user avatar
1 vote
0 answers
29 views

How to deploy multiple instances of the same token/contract and then access them?

HardHat: I can deploy and call a method on, on a single token like this: //............ await deploy("MyToken", { from: deployer, args: [], log: true, ...
user avatar
0 votes
0 answers
50 views

Difference between hardhat scripts and hardhat-deploy?

I've been developing smart contracts for a while using truffle but this is my first hardhat project. I'm trying to wrap my head around the best practices for testing/developing on my local machine but ...
user avatar
1 vote
0 answers
62 views

Hardhat deployment to mainnet

I am preparing for a smart contract deployment to mainnet and I plan on using hardhat. I am trying to find out if there is a dry run style deployment that will simulate the deployment without ...
user avatar
  • 11
0 votes
1 answer
168 views

Payable functions in Metamask

Please share your experience with Metamask/ether.js interaction. I created a payable function and as usual in Remix or Etherscan we can interact with a contract directly (we have inputs to put the ...
user avatar
0 votes
1 answer
36 views

RuntimeError: abort(ReferenceError: proccess is not defined)

I am following this instructions https://hardhat.org/tutorial/deploying-to-a-live-network.html When I run the following command (last step of the instructions) npx hardhat run scripts/deploy.js --...
user avatar
1 vote
1 answer
179 views

Learning hardhat. What is the difference between deploying to localhost and hardhat network?

On one hand, when I run "npx hardhat node --network localhost" it tells me that we can only run hardhat node, so i run "npx hardhat node" and it works. Ok so I am using hardhat ...
user avatar
0 votes
1 answer
349 views

Interacting with Contract instance works on hardhat local rpc but throws error on mumbai testnet

So I'm currently working on an nft marketplace and I have this function that gets all the collections(which are proxy contracts) in the marketplace and gets basic info from the contract, like the name,...
user avatar
  • 133
1 vote
0 answers
61 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 { ...
user avatar
0 votes
1 answer
154 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 ...
user avatar
  • 41
0 votes
1 answer
21 views

Factory contract deploy external contract

I have a factory contract that has rather a small size, it contains the deploy function, and is pausable. I want to extend that contract by adding new features but when I add anything it becomes ...
user avatar
0 votes
0 answers
132 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/...
user avatar
  • 170
1 vote
0 answers
46 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 ...
user avatar
  • 21
0 votes
0 answers
62 views

Problem during deploy a smart contract from an other

i have a question about give permission to one smart contract to be deployed only from an other. I have deployed my first smart contract on mumbai testnet from my hardhat local environment. I have ...
user avatar
0 votes
0 answers
104 views

Why does Hardhat's just deployed contract.address differ from the real one?

I am deploying a contract on the testnet with hardhat, but the address returned is not the real address the contract is at in the blockchain. I am following hardhat's guide. Code: async function main()...
user avatar
0 votes
1 answer
697 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 &...
user avatar
0 votes
1 answer
379 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 ...
user avatar
0 votes
0 answers
805 views

I can't deploy large contracts with Optimizer enabled

I'm aware since Spurious Dragon there's a size limit for the contracts, I cloned this repository to test it locally and learn about how everything works, but I can't deploy some contracts due to the ...
user avatar
1 vote
0 answers
361 views

Testing contract with error did it run Out of Gas?

as I am experimenting with solidity, I have run and deployed my contract locally on a hardhat node: hardhat_addCompilationResult web3_clientVersion eth_chainId eth_accounts eth_blockNumber eth_chainId ...
user avatar
  • 111
1 vote
0 answers
55 views

How to update local search path for nomiclabs-hardhat-etherscan?

The documentation says: Just provide the deployment address and constructor arguments, and the plugin will detect locally which contract to verify however I have some contracts that only implement ...
user avatar
1 vote
2 answers
2k views

hardhat does not find artifact when deploying

After initializing with $ npx hardhat I am having trouble when deploying using hardhat. HardhatError: HH700: Artifact for contract "<contract_name>" not found. I can compile my ...
user avatar
  • 21
0 votes
0 answers
543 views

Hardhat estimatedGas error on smart contract deployment

I'm getting the following error when trying to deploy to BSC testnet: Hardhat Error: cannot estimate gas; transaction may fail or may require manual gas limit (error={"name":"...
user avatar
  • 1