-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhardhat.config.js
47 lines (42 loc) · 1.48 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
require("@nomiclabs/hardhat-waffle");
require("dotenv").config();
const args = process.argv.slice(2);
console.log(args);
let privateKey =
"0x0000000000000000000000000000000000000000000000000000000000000000";
if (process.argv.slice(2)[0] === "deploy") {
privateKey = args[6];
console.log(privateKey);
if (!privateKey) {
throw new Error(
"Private key not provided. Use --private-key argument or set PRIVATE_KEY in .env file.",
);
}
}
module.exports = {
solidity: "0.8.20",
networks: {
neondevnet: {
url: "https://devnet.neonevm.org",
accounts: [`${privateKey}`],
chainId: 245022926,
},
},
};
task("deploy", "Deploys the MyToken contract")
.addPositionalParam("name", "The name of the token")
.addPositionalParam("symbol", "The symbol of the token")
.addPositionalParam("initialSupply", "The initial supply of the token")
.addPositionalParam("privateKey", "The private key of the deployer")
.setAction(async taskArgs => {
console.log(taskArgs);
const [deployer] = await ethers.getSigners();
console.log("Deploying contracts with the account:", deployer.address);
const Token = await ethers.getContractFactory("MyToken");
const token = await Token.deploy(
taskArgs.name,
taskArgs.symbol,
taskArgs.initialSupply,
);
console.log("##" + JSON.stringify({ address: token.address }) + "##");
});