-
Notifications
You must be signed in to change notification settings - Fork 1
/
hardhat.config.ts
148 lines (143 loc) · 5.06 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
// SPDX-FileCopyrightText: 2024 IEXEC BLOCKCHAIN TECH <[email protected]>
// SPDX-License-Identifier: Apache-2.0
import '@nomicfoundation/hardhat-toolbox';
import '@openzeppelin/hardhat-upgrades';
import 'hardhat-dependency-compiler';
import 'hardhat-deploy';
import { HardhatUserConfig, task } from 'hardhat/config';
import {
HARDHAT_NETWORK_MNEMONIC,
defaultHardhatNetworkParams,
defaultLocalhostNetworkParams,
} from 'hardhat/internal/core/config/default-config';
import 'solidity-docgen';
import { forceZeroGasPriceWithSolidityCoverage } from './scripts/utils/modify-solidity-coverage-lib-api-js';
const managerAccount = Number(process.env.IEXEC_VOUCHER_MANAGER_ACCOUNT_INDEX) || null;
const minterAccount = Number(process.env.IEXEC_VOUCHER_MINTER_ACCOUNT_INDEX) || null;
export const isLocalFork = process.env.LOCAL_FORK == 'true';
const bellecourBlockscoutUrl =
process.env.BLOCKSCOUT_VERSION == 'v5'
? 'https://blockscout.bellecour.iex.ec'
: 'https://blockscout-v6.bellecour.iex.ec'; // Use Blockscout v6 by default
const config: HardhatUserConfig = {
solidity: {
compilers: [
{
version: '0.8.27',
settings: {
evmVersion: 'berlin',
/**
* Enable Intermediate Representation (IR) to reduce `Stack too deep` occurrences
* at compile time (e.g.: too many local variables in `matchOrdersBoost`).
* https://hardhat.org/hardhat-runner/docs/reference/solidity-support#support-for-ir-based-codegen
*/
viaIR: true,
optimizer: {
enabled: true,
runs: 200,
details: {
yul: true,
yulDetails: {
optimizerSteps: 'u',
},
},
},
},
},
],
},
networks: {
hardhat: {
hardfork: 'berlin', // No EIP-1559 before London fork
accounts: {
mnemonic: process.env.MNEMONIC || HARDHAT_NETWORK_MNEMONIC,
},
...(isLocalFork && {
forking: {
url: 'https://bellecour.iex.ec',
},
chainId: 134,
}),
gasPrice: 0,
blockGasLimit: 6_700_000,
},
'external-hardhat': {
...defaultHardhatNetworkParams,
...defaultLocalhostNetworkParams,
accounts: 'remote', // will use accounts set in hardhat network config
...(isLocalFork && {
chainId: 134,
}),
gasPrice: 0,
},
'dev-native': {
chainId: 65535,
url: 'http://localhost:8545',
accounts: {
mnemonic: process.env.MNEMONIC || '',
},
gasPrice: 0, // Get closer to Bellecour network
},
bellecour: {
chainId: 134,
url: 'https://bellecour.iex.ec',
accounts: [
process.env.PROD_PRIVATE_KEY ||
'0x0000000000000000000000000000000000000000000000000000000000000000',
],
gasPrice: 0,
gas: 6700000,
},
},
etherscan: {
apiKey: {
bellecour: '<>', // a non-empty string is needed by the plugin.
},
customChains: [
{
network: 'bellecour',
chainId: 134,
urls: {
apiURL: `${bellecourBlockscoutUrl}/api`,
browserURL: bellecourBlockscoutUrl,
},
},
],
},
namedAccounts: {
deployer: {
default: 0,
134: '0xA0C07ad0257522211c6359EC8A4EB5d21A4A1A14', // Bellecour & local fork
},
manager: {
31337: 1, // hardhat & external-hardhat without local fork
'dev-native': 1,
localhost: managerAccount,
134: '0xA0C1939182b454911b78f9b087D5444d7d0E82E3', // Bellecour & local fork
},
minter: {
31337: 2, // hardhat & external-hardhat without local fork
'dev-native': 2,
localhost: minterAccount,
134: '0xA0C26578F762a06c14A8153F87D0EAA2fBd036af', // Bellecour & local fork
},
},
dependencyCompiler: {
paths: [
'@amxx/factory/contracts/v8/GenericFactory.sol',
'@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol',
'@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol',
],
keep: true, // Keep it for slither
},
docgen: {
templates: 'docs/templates',
pages: 'items',
exclude: ['mocks', 'NonTransferableERC20Upgradeable.sol', 'beacon/VoucherProxy.sol'],
},
};
task('coverage').setAction((_, {}, runSuper) => {
forceZeroGasPriceWithSolidityCoverage();
return runSuper();
});
export default config;