-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Expand file tree
/
Copy pathgetters.ts
More file actions
60 lines (54 loc) · 2.41 KB
/
getters.ts
File metadata and controls
60 lines (54 loc) · 2.41 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
import { task, types } from "hardhat/config";
import type { HardhatEthersHelpers, TaskArguments } from "hardhat/types";
import { GatewayConfig } from "../typechain-types";
import { getRequiredEnvVar, loadGatewayAddresses } from "./utils";
async function loadGatewayConfigContract(
useInternalProxyAddress: boolean,
ethers: HardhatEthersHelpers,
): Promise<GatewayConfig> {
if (useInternalProxyAddress) {
loadGatewayAddresses();
}
const gatewayConfigAddress = getRequiredEnvVar("GATEWAY_CONFIG_ADDRESS");
const gatewayConfigFactory = await ethers.getContractFactory("./contracts/GatewayConfig.sol:GatewayConfig");
return gatewayConfigFactory.attach(gatewayConfigAddress).connect(ethers.provider) as GatewayConfig;
}
task("task:getKmsSigners")
.addOptionalParam(
"useInternalProxyAddress",
"If proxy address from the /addresses directory should be used",
false,
types.boolean,
)
.setAction(async function (taskArguments: TaskArguments, { ethers }) {
const gatewayConfig = await loadGatewayConfigContract(taskArguments.useInternalProxyAddress, ethers);
const listCurrentKMSSigners = await gatewayConfig.getKmsSigners();
console.log("The list of current KMS Signers stored inside GatewayConfig contract is: ", listCurrentKMSSigners);
});
task("task:getCoprocessorSigners")
.addOptionalParam(
"useInternalProxyAddress",
"If proxy address from the /addresses directory should be used",
false,
types.boolean,
)
.setAction(async function (taskArguments: TaskArguments, { ethers }) {
const gatewayConfig = await loadGatewayConfigContract(taskArguments.useInternalProxyAddress, ethers);
const listCurrentCoprocessorSigners = await gatewayConfig.getCoprocessorSigners();
console.log(
"The list of current Coprocessor Signers stored inside GatewayConfig contract is: ",
listCurrentCoprocessorSigners,
);
});
task("task:getHostChains")
.addOptionalParam(
"useInternalProxyAddress",
"If proxy address from the /addresses directory should be used",
false,
types.boolean,
)
.setAction(async function (taskArguments: TaskArguments, { ethers }) {
const gatewayConfig = await loadGatewayConfigContract(taskArguments.useInternalProxyAddress, ethers);
const listCurrentHostChains = await gatewayConfig.getHostChains();
console.log("The list of current host chains stored inside GatewayConfig contract is: ", listCurrentHostChains);
});