Skip to content

Instantly share code, notes, and snippets.

@w1nt3r-eth
w1nt3r-eth / deploy.ts
Created December 16, 2021 18:29
Deploy a contract when gas is cheap
// $ yarn hardhat run --network mainnet scripts/deploy.ts
import {BigNumber} from '@ethersproject/bignumber';
import {formatUnits, parseUnits} from '@ethersproject/units';
import {ethers} from 'hardhat';
async function main() {
const gasPrice = await waitForGasPriceBelow(parseUnits('40', 'gwei'));
const Greeter = await ethers.getContractFactory('Greeter');