forked from wemixarchive/governance-contract
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hardhat.config.js
146 lines (130 loc) · 4.37 KB
/
hardhat.config.js
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
require("@nomiclabs/hardhat-waffle");
const { task } = require("hardhat/config");
require("hardhat-gas-reporter");
require("hardhat-contract-sizer");
require("dotenv").config();
const path = require("path");
const sendTx = require("./scripts/sendTx_task").sendTxKeep;
const setting = require("./scripts/setting_task").set;
const changeEnv = require("./scripts/changeEnv_task").changeEnvVal;
const deployGov = require("./scripts/deploy_task").deployGov;
const deployTestGov = require("./scripts/deploy_test_task").deployGov;
const deployLocalGov = require("./scripts/deploy_local_task").deployGov;
const addMember = require("./scripts/addMembers_task").addMembers;
// This is a sample Hardhat task. To learn how to create your own go to
// https://hardhat.org/guides/create-task.html
task("accounts", "Prints the list of accounts", async (taskArgs, hre) => {
const accounts = await hre.ethers.getSigners();
for (const account of accounts) {
console.log(account.address);
}
});
task("deployGov", "Deploy governance contracts")
.addParam("pw").addParam('acc').addParam('conf').setAction(async (taskArgs, hre)=>{
await deployGov(hre, taskArgs.pw, taskArgs.acc, taskArgs.conf);
})
task("addMember", "Add governance members")
.addParam("pw")
.addParam("addr")
.addParam("acc")
.addParam("conf")
.setAction(async (taskArgs, hre)=>{
await addMember(hre, taskArgs.pw, taskArgs.addr, taskArgs.acc, taskArgs.conf);
})
task("deployGovTest", "Deploy governance contracts")
.addParam("pw").setAction(async (taskArgs, hre)=>{
await deployTestGov(hre, taskArgs.pw);
})
task("deployLocalTest", "Deploy governance contracts").addParam("conf")
.setAction(async (taskArgs, hre)=>{
await deployLocalGov(hre, taskArgs.conf);
})
task("changeMP", "Change maxPrioirtyFeePerGas")
.addParam("pw")
.addParam("envValue")
.setAction(async (args, hre) => {
let envName = "maxPriorityFeePerGas";
let envTypes = ["uint256"];
let envValue = [args.envValue];
envMsg = "mp test";
// console.log(envName, types, envValue, msg)
const sets = await setting(hre, args.pw);
await changeEnv(hre, sets, envName, envTypes, envValue, envMsg);
});
task("changeFee", "Change gasLimitAndBaseFee")
.addParam("pw")
.addParam("gasLimit")
.addParam("changeRate")
.addParam("targetPerc")
.addParam("maxBasefee")
.setAction(async (args, hre) => {
let envName = "gasLimitAndBaseFee";
let envTypes = ["uint256", "uint256", "uint256", "uint256"];
let envValue = [args.gasLimit, args.changeRate, args.targetPerc, args.maxBasefee + "0".repeat(9)];
envMsg = "mp test";
// console.log(envName, types, envValue, msg)
const sets = await setting(hre, args.pw);
await changeEnv(hre, sets, envName, envTypes, envValue, envMsg);
});
task("sendTx", "send tx")
.addParam("pw")
.addParam("fromIdx")
.addParam("toIdx")
.addParam("value")
.setAction(async (args, hre) => {
const sets = await setting(hre, args.pw);
await sendTx(hre, sets, args.fromIdx, args.toIdx, args.value);
});
// You need to export an object to set up your config
// Go to https://hardhat.org/config/ to learn more
/**
* @type import('hardhat/config').HardhatUserConfig
*/
const privateKey = process.env.SK;
const rpcURL = process.env.rpc;
module.exports = {
networks: {
hardhat: {
accounts: {
mnemonic: "test test test test test test test test test test test junk",
initialIndex: 0,
accountsBalance: "1000000000" + "0".repeat(18),
},
// forking:{
// url: 'https://api.test.wemix.com'
// },
allowUnlimitedContractSize : true
},
localhost: {
url: "http://127.0.0.1:8545",
},
rpc:{
url: rpcURL
}
},
contractSizer: {
runOnCompile: true,
},
solidity: {
compilers: [
{
version: "0.8.6",
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
],
},
paths: {
sources: path.join(__dirname, "./contracts"),
},
mocha: {
timeout: 1000000,
},
gasReporter: {
enabled: true,
},
};