-
Notifications
You must be signed in to change notification settings - Fork 7
/
hardhat.config.ts
115 lines (105 loc) · 2.98 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
import * as dotenv from 'dotenv';
import { HardhatUserConfig } from 'hardhat/config';
import { HttpNetworkUserConfig } from 'hardhat/types';
import '@typechain/hardhat';
import '@nomiclabs/hardhat-waffle';
import '@nomiclabs/hardhat-ethers';
import 'hardhat-gas-reporter';
import 'solidity-coverage';
import '@openzeppelin/hardhat-upgrades';
import './tasks/social-migrator';
import './tasks/pauser';
dotenv.config();
let productionPrivateKey = process.env.DEPLOYER_ACCOUNT;
try {
if (productionPrivateKey === undefined) {
const homedir = require('os').homedir();
require('path').resolve(homedir, '.point', 'keystore', 'key.json');
const wallet = require('ethereumjs-wallet')
.hdkey.fromMasterSeed(
require('bip39').mnemonicToSeedSync(
require(require('path').resolve(
homedir,
'.point',
'keystore',
'key.json'
)).phrase
)
)
.getWallet();
productionPrivateKey = wallet.getPrivateKey().toString('hex');
}
} catch (error) {
if (!productionPrivateKey) {
console.log(
'Warn: Production account not found. Will not be possible to deploy to Production Network.'
);
}
}
const developmentPrivateKey =
process.env.DEPLOYER_ACCOUNT ||
'0x011967d88c6b79116bb879d4c2bc2c3caa23569edd85dfe0bc596846837bbc8e';
const host = process.env.BLOCKCHAIN_HOST || 'blockchain_node';
const port = process.env.BLOCKCHAIN_PORT || 7545;
const devaddress = `http://${host}:${port}`;
const ynetConfig: HttpNetworkUserConfig = {url: 'http://ynet.point.space:44444'};
const xnetPlutoConfig: HttpNetworkUserConfig = {url: 'https://xnet-pluto-1.point.space'};
const mainnetConfig: HttpNetworkUserConfig = {url: 'https://rpc-mainnet-1.point.space'};
if (productionPrivateKey){
ynetConfig.accounts = [productionPrivateKey];
xnetPlutoConfig.accounts = [productionPrivateKey];
xnetPlutoConfig.gasPrice = 1;
mainnetConfig.accounts = [productionPrivateKey];
mainnetConfig.gasPrice = 7;
}
// You need to export an object to set up your config
// Go to https://hardhat.org/config/ to learn more
const config: HardhatUserConfig = {
solidity: {
compilers: [
{
version: '0.8.0',
settings: {
optimizer: {
enabled: true,
runs: 1000,
},
},
},
{
version: '0.8.4',
settings: {
optimizer: {
enabled: true,
runs: 1000,
},
},
},
{
version: '0.8.7',
settings: {
optimizer: {
enabled: true,
runs: 1000,
},
},
},
],
},
paths: {
artifacts:'./hardhat/build',
sources: './contracts',
tests: './tests/unit/smartcontracts',
cache: './hardhat/cache'
},
networks: {
development: {
url: devaddress,
accounts: [developmentPrivateKey],
},
ynet: ynetConfig,
xnetPluto: xnetPlutoConfig,
main: mainnetConfig
},
};
export default config;