-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhardhat.config.js
More file actions
129 lines (112 loc) · 3.28 KB
/
Copy pathhardhat.config.js
File metadata and controls
129 lines (112 loc) · 3.28 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
129
const { task } = require("hardhat/config");
require("@nomicfoundation/hardhat-toolbox");
require("@nomiclabs/hardhat-etherscan");
require('hardhat-deploy');
require("hardhat-gas-reporter");
require('hardhat-contract-sizer');
require("dotenv").config();
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("increment", "Increments the nonce by 1")
.setAction(async (taskArgs, hre) => {
const [deployer] = await ethers.getSigners();
console.log(`✅ Connected to ${deployer.address}`);
console.log('✅ Incrementing nonce by 1')
await deployer.sendTransaction({ to: deployer.address, value: 0 })
console.log('✅ Done')
});
task("deploy", "Deploys $METRIC to the network")
.addOptionalParam("verify", "Verify the deployed contracts on Etherscan", false, types.boolean)
.setAction(async (taskArgs, hre) => {
await hre.run('compile');
const [deployer] = await ethers.getSigners();
console.log(`✅ Connected to ${deployer.address}`);
const chainId = await getChainId()
console.log('✅ Connected to chain ' + chainId)
const layerZeroDecimals = 5
const layerZeroEndpoint = '0x66A71Dcef29A0fFBDBE3c6a460a3B5BC225Cd675'
const MetricToken = await ethers.getContractFactory("MetricToken");
let metricToken = await MetricToken.deploy(
"Metric",
"METRIC",
layerZeroDecimals,
layerZeroEndpoint
);
metricToken = await metricToken.deployed();
console.log("✅ MetricToken Deployed.")
metricDeployment = {
"Deployer": deployer.address,
"MetricToken Address": metricToken.address,
"Remaining ETH Balance": parseInt((await deployer.getBalance()).toString()) / 1000000000000000000,
}
console.table(metricDeployment)
if (chainId == '31337' || taskArgs.verify === false) return;
await new Promise(r => setTimeout(r, 30000));
await hre.run("verify:verify", {
address: metricToken.address,
constructorArguments: [
"Metric",
"METRIC",
layerZeroDecimals,
layerZeroEndpoint
],
});
console.log("✅ MetricToken verified.")
});
module.exports = {
solidity: {
compilers: [
{
version: "0.8.17",
settings: {
optimizer: {
enabled: true,
runs: 10000
}
}
}
],
},
etherscan: {
apiKey: {
mainnet: process.env.ETHERSCAN_API_KEY,
}
},
gasReporter: {
enabled: true,
currency: 'USD',
gasPrice: 67,
coinmarketcap: process.env.COINMARKETCAP_API_KEY,
showMethodSig: true,
showTimeSpent: true,
},
contractSizer: {
alphaSort: false,
disambiguatePaths: true,
runOnCompile: true,
},
networks: {
hardhat: {
chainId: 1337,
gas: "auto",
gasPrice: "auto",
saveDeployments: false,
mining: {
auto: false,
order: 'fifo',
interval: 1500,
},
allowUnlimitedContractSize: true
},
mainnet: {
url: `https://eth-mainnet.alchemyapi.io/v2/${process.env.ETH_ALCHEMY_KEY}`,
accounts: [`0x${process.env.PRIVATE_KEY}`],
gasPrice: 50000000000,
allowUnlimitedContractSize: true
}
}
};