This repository has been archived by the owner on Jun 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
hardhat.config.ts
82 lines (74 loc) · 2.32 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
import { HardhatUserConfig } from 'hardhat/config'
import '@nomicfoundation/hardhat-toolbox'
import '@nomiclabs/hardhat-etherscan'
import 'hardhat-gas-reporter'
import '@typechain/hardhat'
import '@nomiclabs/hardhat-ethers'
import '@primitivefi/hardhat-dodoc'
import 'hardhat-deploy'
import '@openzeppelin/hardhat-upgrades'
import { getPrivateKeyForRole } from './helpers/network'
// RPC Envs
const POLYGON_RPC_URL = process.env.POLYGON_RPC_URL || ''
// API Envs
const POLYGONSCAN_API_KEY = process.env.POLYGONSCAN_API_KEY || ''
const COIN_MARKET_API_KEY = process.env.COIN_MARKET_API_KEY || ''
const NODE_ENV = process.env.NODE_ENV || ''
const config: HardhatUserConfig = {
solidity: '0.8.9',
defaultNetwork: 'hardhat',
networks: {
// NOTE: Hardhat accounts remain deterministic for all hardhat node instances (not tied to machine)
// see https://hardhat.org/hardhat-network/docs/overview#running-stand-alone-in-order-to-support-wallets-and-other-software
hardhat: {
chainId: 31337,
},
localhost: {
chainId: 31337,
},
...(NODE_ENV === 'staging' && {
polygonMumbai: {
url: POLYGON_RPC_URL,
accounts: [getPrivateKeyForRole('DSGD_DEPLOYER'), getPrivateKeyForRole('PBM_DEPLOYER')],
chainId: 80001,
},
}),
// TODO: Override config to using a manual gas ticker for polygon
// See EIP-1559 implementation discrepancy for Polygon Mainnet
...(NODE_ENV === 'production' && {
polygon: {
url: POLYGON_RPC_URL,
accounts: [getPrivateKeyForRole('DSGD_DEPLOYER'), getPrivateKeyForRole('PBM_DEPLOYER')],
chainId: 137,
},
}),
},
namedAccounts: {
DSGDDeployer: 0, // For all networks, default the first account as DSGD admin (index 0)
PBMDeployer: 1, // For all networks, default the first account as PBM admin (index 1)
},
// Plugin configurations //
etherscan: {
apiKey: {
polygonMumbai: POLYGONSCAN_API_KEY,
polygon: POLYGONSCAN_API_KEY,
},
},
gasReporter: {
enabled: true,
token: 'MATIC',
currency: 'SGD',
outputFile: 'gas-report.txt',
noColors: true,
coinmarketcap: COIN_MARKET_API_KEY,
},
typechain: {
outDir: 'typechain-types',
target: 'ethers-v5',
},
dodoc: {
runOnCompile: false,
include: ['IPBM.sol', 'PBMToken.sol'],
},
}
export default config