hardhat config updates

This commit is contained in:
Vaibhav Khanna 2022-04-15 18:34:56 +05:30
parent cecc43aa95
commit bec1d6370f
3 changed files with 55 additions and 27 deletions

View File

@ -1,3 +1,3 @@
ETHERSCAN_API_KEY=ABC123ABC123ABC123ABC123ABC123ABC1 ETHERSCAN_API_KEY=ABC123ABC123ABC123ABC123ABC123ABC1
ROPSTEN_URL=https://eth-ropsten.alchemyapi.io/v2/<YOUR ALCHEMY KEY> ALCHEMY_API_KEY=<YOUR ALCHEMY KEY>
PRIVATE_KEY=0xabc123abc123abc123abc123abc123abc123abc123abc123abc123abc123abc1 PRIVATE_KEY=0xabc123abc123abc123abc123abc123abc123abc123abc123abc123abc123abc1

View File

@ -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 // You need to export an object to set up your config
// Go to https://hardhat.org/config/ to learn more // Go to https://hardhat.org/config/ to learn more
const config: HardhatUserConfig = { 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: { networks: {
ropsten: { hardhat: {
url: process.env.ROPSTEN_URL || "", forking: {
accounts: url: `https://eth-mainnet.alchemyapi.io/v2/${alchemyApiKey}`,
process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [], // 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: { gasReporter: {
@ -38,6 +82,9 @@ const config: HardhatUserConfig = {
etherscan: { etherscan: {
apiKey: process.env.ETHERSCAN_API_KEY, apiKey: process.env.ETHERSCAN_API_KEY,
}, },
mocha: {
timeout: 10000 * 10000,
}
}; };
export default config; export default config;

View File

@ -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!");
});
});