/
hardhat.config.ts
95 lines (86 loc) · 2.73 KB
/
hardhat.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import { task } from "hardhat/config";
import { HardhatUserConfig, HttpNetworkUserConfig } from "hardhat/types";
import "@typechain/hardhat";
import 'hardhat-deploy';
import '@nomiclabs/hardhat-ethers';
import "@nomiclabs/hardhat-waffle";
import "@nomiclabs/hardhat-etherscan";
import "hardhat-gas-reporter";
import "@nomiclabs/hardhat-web3";
import { setupSafeDeployer } from "hardhat-safe-deployer";
import { Wallet } from "@ethersproject/wallet";
import dotenv from "dotenv";
dotenv.config();
const { MNEMONIC, MNEMONIC_PATH, SAFE_SERVICE_URL, GNOSIS_SAFE_ADDRESS } = process.env;
setupSafeDeployer(
Wallet.fromMnemonic(MNEMONIC!!, MNEMONIC_PATH),
GNOSIS_SAFE_ADDRESS!!,
SAFE_SERVICE_URL
)
const sharedNetworkConfig: HttpNetworkUserConfig = {};
sharedNetworkConfig.accounts = {
mnemonic: MNEMONIC!!
};
// This is a sample Hardhat task. To learn how to create your own go to
// https://hardhat.org/guides/create-task.html
task("accounts", "Prints the list of accounts", async (_, hre) => {
const accounts = await hre.ethers.getSigners();
for (const account of accounts) {
console.log(await account.address);
}
});
task("safe", "Prints the configured safe account for mainnet deployments", async (_, hre) => {
const { deployer } = await hre.getNamedAccounts();
console.log(deployer);
});
const userConfig: HardhatUserConfig = {
defaultNetwork: "hardhat",
solidity: {
compilers: [
{
version: "0.8.7",
settings: {
optimizer: {
enabled: true,
runs: 1200,
},
}
}
]
},
networks: {
localhost: {
...sharedNetworkConfig,
url: "http://localhost:8545",
chainId: 31337
},
arbitrum: {
...sharedNetworkConfig,
url: "https://arb1.arbitrum.io/rpc",
chainId: 42161
}
},
namedAccounts: {
deployer: GNOSIS_SAFE_ADDRESS!!,
},
gasReporter: {
currency: "USD",
},
typechain: {
outDir: "types",
target: "ethers-v5",
alwaysGenerateOverloads: false, // should overloads with full signatures like deposit(uint256) be generated always, even if there are no overloads?
externalArtifacts: ["artifacts/contracts/**/.json"], // optional array of glob patterns with external artifacts to process (for example external libs from node_modules)
},
external: process.env.HARDHAT_FORK
? {
deployments: {
// process.env.HARDHAT_FORK will specify the network that the fork is made from.
// these lines allow it to fetch the deployments from the network being forked from both for node and deploy task
hardhat: ['deployments/' + process.env.HARDHAT_FORK],
localhost: ['deployments/' + process.env.HARDHAT_FORK],
},
}
: undefined
};
export default userConfig