I'd like to set a gasPrice
in my deploy script, so I could deploy and let miners pick up my transaction when gas is low. Like deploy my contract over night while I'm sleeping to save money.
How can I specify the gas price in my ethers deploy script?
const MyContract = await ethers.getContractFactory('MyContract', signer);
const mycontract = await MyContract.deploy();
await mycontract.deployed();
console.log('Deployed to:', mycontract.address);
Best Answer
You can override the
options
property of a transaction by adding an object as the last parameter:You can also specify a global gas price in your hardhat config. Something like this: