-
Notifications
You must be signed in to change notification settings - Fork 1
/
hardhat.config.ts
95 lines (73 loc) · 3.34 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
import {HardhatUserConfig, task} from "hardhat/config";
import "@nomicfoundation/hardhat-toolbox";
import fs from "fs";
const mnemonic = fs.readFileSync(".secret").toString().trim();
const config: HardhatUserConfig = {
networks: {
hardhat: {
},
rskTestnet: {
chainId: 31,
url: 'https://public-node.testnet.rsk.co/',
gasMultiplier: 1.1,
accounts: {
mnemonic: mnemonic,
// initialIndex: 0,
// path: "m/44'/60'/0'/0",
// count: 10,
},
}
},
solidity: "0.8.9",
};
task("mint-doc", "Mints DoC tokens")
.addParam("minterAddr", "DocMinter contract address")
.addParam("rbtcToMint", "The amount in wei to use for minting DoC tokens")
.setAction(async (taskArgs, hre) => {
const docMinterAddr = taskArgs.minterAddr;
const rbtcToMint = taskArgs.rbtcToMint;
const accounts = await hre.ethers.getSigners();
const DocMinter = await hre.ethers.getContractFactory("DocMinter");
const docMinter = await DocMinter.attach(docMinterAddr);
console.log("DocMinter deployed to:", docMinter.address);
const receiverAddr = await accounts[1].getAddress();
console.log("receiverAddr:", receiverAddr);
const refundAddr = await accounts[2].getAddress();
console.log("refundAddr:", refundAddr);
const resuot = await docMinter.mintDoc(receiverAddr, refundAddr, {value: rbtcToMint, gasLimit: 1_000_000});
console.log("Mint result:", resuot);
});
task("mint-rdoc", "Mints RDoC tokens")
.addParam("minterAddr", "RDocMinter contract address")
.addParam("rbtcToMint", "The amount in wei to use for minting RDoC tokens")
.setAction(async (taskArgs, hre) => {
const rdocMinterAddr = taskArgs.minterAddr;
const rbtcToMint = taskArgs.rbtcToMint;
const accounts = await hre.ethers.getSigners();
const RDocMinter = await hre.ethers.getContractFactory("RDocMinter");
const rdocMinter = await RDocMinter.attach(rdocMinterAddr);
console.log("RDocMinter deployed to:", rdocMinter.address);
const receiverAddr = await accounts[1].getAddress();
console.log("receiverAddr:", receiverAddr);
const refundAddr = await accounts[2].getAddress();
console.log("refundAddr:", refundAddr);
const resuot = await rdocMinter.mintRDoc(receiverAddr, refundAddr, {value: rbtcToMint, gasLimit: 1_000_000});
console.log("Mint result:", resuot);
});
task("mint-rdoc-tx", "Returns tx data that can be used for minting RDoC tokens")
.addParam("minterAddr", "RDocMinter contract address")
.addParam("receiverAddr", "Receiver address")
.addParam("refundAddr", "Refund address")
.setAction(async (taskArgs, hre) => {
const rdocMinterAddr = taskArgs.minterAddr;
const receiverAddr = taskArgs.receiverAddr;
const refundAddr = taskArgs.refundAddr;
console.log("receiverAddr:", receiverAddr);
console.log("refundAddr:", refundAddr);
const RDocMinter = await hre.ethers.getContractFactory("RDocMinter");
const rdocMinter = await RDocMinter.attach(rdocMinterAddr);
console.log("RDocMinter deployed to:", rdocMinter.address);
const tx = await rdocMinter.populateTransaction.mintRDoc(receiverAddr, refundAddr);
console.log("Mint tx:", tx);
});
export default config;