Skip to content

Commit 377b6f6

Browse files
committed
Update Hardhat config for deployment
1 parent 6de4638 commit 377b6f6

4 files changed

Lines changed: 163 additions & 5 deletions

File tree

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,8 @@ node_modules
44
cache
55
artifacts
66

7+
.env
8+
.env*
9+
10+
todos.md
711
todos.md

hardhat.config.ts

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { task, HardhatUserConfig } from "hardhat/config";
22
import "@nomiclabs/hardhat-waffle";
3+
import "@nomiclabs/hardhat-etherscan";
34

45
// This is a sample Hardhat task. To learn how to create your own go to
56
// https://hardhat.org/guides/create-task.html
@@ -12,22 +13,47 @@ task("accounts", "Prints the list of accounts", async () => {
1213
}
1314
});
1415

16+
const ROPSTEN_PRIVATE_KEY = process.env.ROPSTEN_PRIVATE_KEY;
17+
const ROPSTEN_ALCHEMY_API_KEY = process.env.ROPSTEN_ALCHEMY_API_KEY;
18+
19+
const MUMBAI_PRIVATE_KEY = process.env.MUMBAI_PRIVATE_KEY;
20+
const MUMBAI_ALCHEMY_API_KEY = process.env.MUMBAI_ALCHEMY_API_KEY;
21+
22+
const ETHERSCAN_API_KEY = process.env.ETHERSCAN_API_KEY;
23+
const POLYGONSCAN_API_KEY = process.env.POLYGONSCAN_API_KEY;
24+
1525
// You need to export an object to set up your config
1626
// Go to https://hardhat.org/config/ to learn more
17-
18-
/**
19-
* @type import('hardhat/config').HardhatUserConfig
20-
*/
2127
const config: HardhatUserConfig = {
2228
solidity: {
2329
version: "0.8.9",
2430
settings: {
2531
optimizer: {
2632
enabled: true,
27-
runs: 1000,
33+
runs: 200,
2834
},
2935
},
3036
},
37+
networks: {
38+
ropsten: {
39+
url: `https://eth-ropsten.alchemyapi.io/v2/${ROPSTEN_ALCHEMY_API_KEY}`,
40+
accounts: [ROPSTEN_PRIVATE_KEY],
41+
},
42+
mumbai: {
43+
url: `https://polygon-mumbai.g.alchemy.com/v2/${MUMBAI_ALCHEMY_API_KEY}`,
44+
accounts: [MUMBAI_PRIVATE_KEY],
45+
},
46+
},
47+
etherscan: {
48+
apiKey: {
49+
// Ethereum
50+
mainnet: ETHERSCAN_API_KEY,
51+
ropsten: ETHERSCAN_API_KEY,
52+
// polygon
53+
polygon: POLYGONSCAN_API_KEY,
54+
polygonMumbai: POLYGONSCAN_API_KEY,
55+
},
56+
},
3157
};
3258

3359
export default config;

package-lock.json

Lines changed: 127 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
},
88
"devDependencies": {
99
"@nomiclabs/hardhat-ethers": "^2.0.2",
10+
"@nomiclabs/hardhat-etherscan": "^3.0.0",
1011
"@nomiclabs/hardhat-waffle": "^2.0.1",
1112
"@types/chai": "^4.3.0",
1213
"@types/mocha": "^8.2.3",

0 commit comments

Comments
 (0)