-
Notifications
You must be signed in to change notification settings - Fork 2
/
hardhat.config.js
86 lines (81 loc) · 3.29 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
require("@nomicfoundation/hardhat-toolbox");
require("@nomicfoundation/hardhat-web3-v4");
const { settings, utils } = require("witnet-solidity-bridge")
const [, target ] = utils.getRealmNetworkFromString();
task("pfs:deploy", "Upgrade price feeds")
.addOptionalParam("from", "EVM address used for interacting with the WitnetPriceFeeds contract.")
.addOptionalVariadicPositionalParam("captions", "Captions of the price feeds to be either deployed or have data sources upgraded (e.g. eth/usd-6).")
.setAction(async (taskArgs) => {
const deploy = require("./scripts/hardhat/pfs-deploy");
await deploy.run(taskArgs).catch((error) => {
console.error(error);
process.exitCode = 1;
})
}
);
task("pfs:sla", "Get default Witnet SLA")
.addOptionalParam("committeeSize", "Minimum number of witnesses required for every price update.")
.addOptionalParam("collateralFee", "Minimum collateral in $nanoWIT required for witnessing nodes.")
.addOptionalParam("from", "EVM address used for interacting with the WitnetPriceFeeds contract.")
.setAction(async (taskArgs) => {
const script = require("./scripts/hardhat/pfs-sla");
await script.run(taskArgs).catch((error) => {
console.error(error);
process.exitCode = 1;
})
}
);
task("pfs:status", "Show current status of supported price feeds.")
.addFlag("update", "Trigger an update on the price feeds, if currently idle.")
.addFlag("updateForce", "Trigger an update on idle price feeds, or potentially increase the reward if already awaiting an update.")
.addOptionalParam("from", "EVM address used for interacting with the WitnetPriceFeeds contract.")
.addOptionalVariadicPositionalParam("captions", "Captions of the price feeds to be listed, or updated (e.g. eth/usd-6).")
.setAction(async (taskArgs) => {
const script = require("./scripts/hardhat/pfs-status");
await script.run(taskArgs).catch((error) => {
console.error(error);
process.exitCode = 1;
})
}
);
/** @type import('hardhat/config').HardhatUserConfig */
module.exports = {
networks: Object.fromEntries(Object.entries(settings.getNetworks())
.map(([network, config]) => {
return [network, {
chainId: config.network_id,
gasLimit: config?.gas,
gasPrice: config?.gasPrice,
url: `http://${config?.host || "localhost"}:${config?.port || 8545}`
}]
})
),
solidity: settings.getCompilers(target),
sourcify: {
enabled: true,
apiUrl: "https://sourcify.dev/server",
browserUrl: "https://repo.sourcify.dev",
},
etherscan: {
apiKey: Object.fromEntries(
Object.entries(settings.getNetworks())
.filter(([,config]) => config?.verify)
.map(([network, config]) => {
const [ecosystem,] = utils.getRealmNetworkFromString(network)
return [network, config?.verify?.apiKey ?? `ETHERSCAN_${ecosystem.toUpperCase()}_API_KEY`]
}),
),
customChains: Object.entries(settings.getNetworks())
.filter(([,config]) => config?.verify)
.map(([network, config]) => {
return {
network,
chainId: config.network_id,
urls: {
apiURL: config?.apiUrl,
browserURL: config?.browserUrl
}
}
}),
}
};