-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhardhat.config.ts
More file actions
128 lines (119 loc) · 3.61 KB
/
hardhat.config.ts
File metadata and controls
128 lines (119 loc) · 3.61 KB
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
/* eslint-disable @typescript-eslint/require-await */
/* eslint-disable no-underscore-dangle */
/* eslint-disable import/order */
// This adds support for typescript paths mappings
import 'tsconfig-paths/register';
import 'global-jsdom/register';
import { utils } from 'ethers';
import '@typechain/hardhat';
import '@nomiclabs/hardhat-waffle';
import '@nomiclabs/hardhat-ethers';
import '@tenderly/hardhat-tenderly';
// import 'hardhat-deploy';
// not required as we are using @nomiclabs/hardhat-ethers@npm:hardhat-deploy-ethers
// import 'solidity-coverage';
import * as fs from 'fs';
import { HardhatUserConfig } from 'hardhat/config';
import { TEthers } from '~~/helpers/hardhat-type-extensions';
declare module 'hardhat/types/runtime' {
// This is an example of an extension to the Hardhat Runtime Environment.
// This new field will be available in tasks' actions, scripts, and tests.
export interface HardhatRuntimeEnvironment {
ethers: TEthers;
}
}
const { isAddress, getAddress, formatUnits, parseUnits } = utils;
//
// Select the network you want to deploy to here:
//
const defaultNetwork = 'localhost';
const getMnemonic = (): string => {
try {
return fs.readFileSync('./mnemonic.secret').toString().trim();
} catch (e) {
// @ts-ignore
if (defaultNetwork !== 'localhost') {
console.log(
'☢️ WARNING: No mnemonic file created for a deploy account. Try `yarn run generate` and then `yarn run account`.'
);
}
}
return '';
};
const config: HardhatUserConfig = {
defaultNetwork: 'hardhat',
networks: {
hardhat: {
mining: {
auto: true,
},
},
},
mocha: {
bail: false,
allowUncaught: false,
require: ['ts-node/register'],
timeout: 30000,
reporter: process.env.GITHUB_ACTIONS === 'true' ? 'mocha-junit-reporter' : 'spec',
reporterOptions: {
mochaFile: 'testresult.xml',
},
},
namedAccounts: {
deployer: {
default: 0, // here this will by default take the first account as deployer
},
},
// don't forget to set your provider like:
// REACT_APP_PROVIDER=https://dai.poa.network in packages/react-app/.env
// (then your frontend will talk to your contracts on the live network!)
// (you will need to restart the `yarn run start` dev server after editing the .env)
solidity: {
compilers: [
{
version: '0.8.6',
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
{
version: '0.7.6',
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
{
version: '0.6.7',
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
],
},
paths: {
sources: './src/contracts',
cache: './src/generated/cache',
artifacts: './src/generated/artifacts',
deployments: './src/generated/deployments',
},
typechain: {
outDir: './src/generated/contract-types',
},
};
export default config;
// subtask(TASK_COMPILE_SOLIDITY_GET_SOURCE_PATHS, async (_, { config }, runSuper) => {
// const sources = await runSuper();
// const testSources = await glob(join(config.paths.tests, '**', '*.sol'));
// const erc20Sources = await glob(join('node_modules', '@openzeppelin/contracts/token/ERC20/ERC20.sol'));
// // eslint-disable-next-line @typescript-eslint/no-unsafe-return
// return [...sources, ...testSources, ...erc20Sources];
// });