-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhardhat.config.ts
98 lines (93 loc) · 2.35 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
96
97
98
import { HardhatUserConfig, } from "hardhat/config";
import { SolcUserConfig } from 'hardhat/types'
import "@typechain/hardhat";
import "@nomicfoundation/hardhat-ethers";
import "@nomicfoundation/hardhat-verify";
import "solidity-coverage";
import '@openzeppelin/hardhat-upgrades';
import '@nomicfoundation/hardhat-chai-matchers';
import dotenv from 'dotenv-extended';
dotenv.load()
const { ETHERSCAN_API_KEY } = process.env;
const getAccounts = (network: string): string[] | undefined => {
let accounts
const privateKey = process.env[`${network}_PRIVATE_KEY`]
if (privateKey) {
accounts = [privateKey]
}
return accounts
}
const DEFAULT_COMPILER_SETTINGS: SolcUserConfig = {
version: '0.8.4',
settings: {
optimizer: {
enabled: true,
runs: 1_000_000,
},
metadata: {
bytecodeHash: 'none',
},
},
}
interface EtherscanConfig {
apiKey: {
sepolia: string
arbitrumSepolia: string
arbitrumOne: string
},
customChains: any
}
const EtherscanConfig: EtherscanConfig = {
apiKey: {
sepolia: ETHERSCAN_API_KEY || "",
arbitrumSepolia: ETHERSCAN_API_KEY || "",
arbitrumOne: ETHERSCAN_API_KEY || ""
},
customChains: [
{
network: "arbitrumSepolia",
chainId: 421614,
urls: {
apiURL: "https://api-sepolia.arbiscan.io/api",
browserURL: "https://sepolia.arbiscan.io/",
},
},
],
};
interface ExtendedHardhatUserConfig extends HardhatUserConfig {
etherscan: EtherscanConfig;
}
const config: ExtendedHardhatUserConfig = {
networks: {
hardhat: {
allowUnlimitedContractSize: false,
},
mainnet: {
url: `https://mainnet.infura.io/v3/${process.env.MAINNET_INFURA_API_KEY}`,
accounts: getAccounts('MAINNET'),
},
arbitrumOne: {
url: "https://arb1.arbitrum.io/rpc",
chainId: 42161,
accounts: getAccounts('ARBITRUMONE'),
gasMultiplier: 1.2,
timeout: 0,
},
ropsten: {
url: `https://ropsten.infura.io/v3/${process.env.ROPSTEN_INFURA_API_KEY}`,
accounts: getAccounts('ROPSTEN'),
},
arbitrumSepolia: {
url: 'https://sepolia-rollup.arbitrum.io/rpc',
chainId: 421614,
accounts: getAccounts('ARBITRUMSEPOLIA'),
gasMultiplier: 1.2,
timeout: 0,
},
},
solidity: {
compilers: [DEFAULT_COMPILER_SETTINGS],
},
etherscan: EtherscanConfig,
}
export default config