From bec1d6370fa7a4c571b7a0e40113441a56fa87a1 Mon Sep 17 00:00:00 2001 From: Vaibhav Khanna Date: Fri, 15 Apr 2022 18:34:56 +0530 Subject: [PATCH] hardhat config updates --- .env.example | 4 ++-- hardhat.config.ts | 59 ++++++++++++++++++++++++++++++++++++++++++----- test/index.ts | 19 --------------- 3 files changed, 55 insertions(+), 27 deletions(-) delete mode 100644 test/index.ts diff --git a/.env.example b/.env.example index 861d3b1..ae6ba93 100644 --- a/.env.example +++ b/.env.example @@ -1,3 +1,3 @@ ETHERSCAN_API_KEY=ABC123ABC123ABC123ABC123ABC123ABC1 -ROPSTEN_URL=https://eth-ropsten.alchemyapi.io/v2/ -PRIVATE_KEY=0xabc123abc123abc123abc123abc123abc123abc123abc123abc123abc123abc1 +ALCHEMY_API_KEY= +PRIVATE_KEY=0xabc123abc123abc123abc123abc123abc123abc123abc123abc123abc123abc1 \ No newline at end of file diff --git a/hardhat.config.ts b/hardhat.config.ts index 0f1c6e1..d4040de 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -19,16 +19,60 @@ task("accounts", "Prints the list of accounts", async (taskArgs, hre) => { } }); +const alchemyApiKey = process.env.ALCHEMY_API_KEY; +if (!alchemyApiKey) { + throw new Error("Please set your ALCHEMY_ETH_API_KEY in a .env file"); +} + // You need to export an object to set up your config // Go to https://hardhat.org/config/ to learn more const config: HardhatUserConfig = { - solidity: "0.8.4", + solidity: { + compilers: [ + { + version: "0.8.6", + settings: { + optimizer: { + enabled: true, + runs: 200, + }, + }, + }, + { + version: "0.7.6", + settings: { + optimizer: { + enabled: true, + runs: 200, + }, + }, + }, + { + version: "0.5.6", + settings: { + optimizer: { + enabled: true, + runs: 200, + }, + }, + }, + ], + }, networks: { - ropsten: { - url: process.env.ROPSTEN_URL || "", - accounts: - process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [], + hardhat: { + forking: { + url: `https://eth-mainnet.alchemyapi.io/v2/${alchemyApiKey}`, + // blockNumber: 14501064 + }, + chainId: 1, + gasPrice: 151101000000, + }, + mainnet: { + url: `https://eth-mainnet.alchemyapi.io/v2/${alchemyApiKey}`, + chainId: 1, + gasPrice: 52101000000, + accounts: [`0x${process.env.PRIVATE_KEY}`] }, }, gasReporter: { @@ -38,6 +82,9 @@ const config: HardhatUserConfig = { etherscan: { apiKey: process.env.ETHERSCAN_API_KEY, }, + mocha: { + timeout: 10000 * 10000, + } }; -export default config; +export default config; \ No newline at end of file diff --git a/test/index.ts b/test/index.ts deleted file mode 100644 index 96aae1e..0000000 --- a/test/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { expect } from "chai"; -import { ethers } from "hardhat"; - -describe("Greeter", function () { - it("Should return the new greeting once it's changed", async function () { - const Greeter = await ethers.getContractFactory("Greeter"); - const greeter = await Greeter.deploy("Hello, world!"); - await greeter.deployed(); - - expect(await greeter.greet()).to.equal("Hello, world!"); - - const setGreetingTx = await greeter.setGreeting("Hola, mundo!"); - - // wait until the transaction is mined - await setGreetingTx.wait(); - - expect(await greeter.greet()).to.equal("Hola, mundo!"); - }); -});