@witnet/solidity 3.0.4 → 3.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +2 -2
- package/build/contracts/Bech32.json +1 -1
- package/build/contracts/Clonable.json +1 -1
- package/build/contracts/Context.json +1 -1
- package/build/contracts/Create3.json +1 -1
- package/build/contracts/ERC165.json +1 -1
- package/build/contracts/Escrowable.json +1 -1
- package/build/contracts/IChainlinkAggregatorV3.json +1 -1
- package/build/contracts/IERC165.json +1 -1
- package/build/contracts/IERC20.json +1 -1
- package/build/contracts/IERC2362.json +1 -1
- package/build/contracts/IPythChainlinkAggregatorV3.json +1 -1
- package/build/contracts/IWitAppliance.json +1 -1
- package/build/contracts/IWitOracle.json +1 -1
- package/build/contracts/IWitOracleAppliance.json +1 -1
- package/build/contracts/IWitOracleConsumer.json +1 -1
- package/build/contracts/IWitOracleConsumerLegacy.json +1 -1
- package/build/contracts/IWitOracleLegacy.json +1 -1
- package/build/contracts/IWitOracleQueriable.json +1 -1
- package/build/contracts/IWitOracleQueriableConsumer.json +1 -1
- package/build/contracts/IWitOracleQueriableEvents.json +1 -1
- package/build/contracts/IWitOracleQueriableExperimental.json +1 -1
- package/build/contracts/IWitOracleQueriableTrustableReporter.json +1 -1
- package/build/contracts/IWitOracleQueriableTrustlessReporter.json +1 -1
- package/build/contracts/IWitOracleRadonRegistry.json +1 -1
- package/build/contracts/IWitOracleRadonRegistryEvents.json +1 -1
- package/build/contracts/IWitOracleRadonRegistryLegacy.json +1 -1
- package/build/contracts/IWitOracleRadonRequestFactory.json +1 -1
- package/build/contracts/IWitOracleRadonRequestModal.json +1 -1
- package/build/contracts/IWitOracleRadonRequestTemplate.json +1 -1
- package/build/contracts/IWitOracleRequest.json +1 -1
- package/build/contracts/IWitOracleRequestFactory.json +1 -1
- package/build/contracts/IWitOracleRequestFactoryEvents.json +1 -1
- package/build/contracts/IWitOracleRequestTemplate.json +1 -1
- package/build/contracts/IWitOracleTrustableAdmin.json +1 -1
- package/build/contracts/IWitOracleTrustless.json +1 -1
- package/build/contracts/IWitPriceFeeds.json +1 -1
- package/build/contracts/IWitPriceFeedsAdmin.json +1 -1
- package/build/contracts/IWitPriceFeedsConsumer.json +1 -1
- package/build/contracts/IWitPriceFeedsEvents.json +1 -1
- package/build/contracts/IWitPriceFeedsLegacy.json +1 -1
- package/build/contracts/IWitPriceFeedsLegacyAdmin.json +1 -1
- package/build/contracts/IWitPriceFeedsLegacySolver.json +1 -1
- package/build/contracts/IWitPriceFeedsLegacySolverFactory.json +1 -1
- package/build/contracts/IWitPriceFeedsTypes.json +1 -1
- package/build/contracts/IWitPyth.json +1 -1
- package/build/contracts/IWitPythChainlinkAggregator.json +1 -1
- package/build/contracts/IWitPythErrors.json +1 -1
- package/build/contracts/IWitPythEvents.json +1 -1
- package/build/contracts/IWitPythReporter.json +1 -1
- package/build/contracts/IWitRandomness.json +1 -1
- package/build/contracts/IWitRandomnessAdmin.json +1 -1
- package/build/contracts/IWitRandomnessAdminV2.json +1 -1
- package/build/contracts/IWitRandomnessConsumer.json +1 -1
- package/build/contracts/IWitRandomnessEvents.json +1 -1
- package/build/contracts/IWitRandomnessLegacy.json +1 -1
- package/build/contracts/IWitRandomnessTypes.json +1 -1
- package/build/contracts/Initializable.json +1 -1
- package/build/contracts/OVM_GasPriceOracle.json +1 -1
- package/build/contracts/Ownable.json +1 -1
- package/build/contracts/Ownable2Step.json +1 -1
- package/build/contracts/Payable.json +1 -1
- package/build/contracts/Proxiable.json +1 -1
- package/build/contracts/ReentrancyGuard.json +1 -1
- package/build/contracts/Secp256k1.json +1 -1
- package/build/contracts/Slices.json +1 -1
- package/build/contracts/TestBech32.json +1 -1
- package/build/contracts/TestSecp256k1.json +1 -1
- package/build/contracts/Upgradeable.json +1 -1
- package/build/contracts/UsingWitOracle.json +1 -1
- package/build/contracts/UsingWitPriceFeeds.json +1 -1
- package/build/contracts/UsingWitRandomness.json +1 -1
- package/build/contracts/WitOracle.json +2 -13
- package/build/contracts/WitOracleBasePushOnly.json +1 -1
- package/build/contracts/WitOracleBasePushOnlyTrustable.json +1 -1
- package/build/contracts/WitOracleBasePushOnlyTrustless.json +1 -1
- package/build/contracts/WitOracleBasePushOnlyUpgradable.json +1 -1
- package/build/contracts/WitOracleBaseQueriable.json +1 -1
- package/build/contracts/WitOracleBaseQueriableTrustable.json +1 -1
- package/build/contracts/WitOracleBaseQueriableTrustless.json +1 -1
- package/build/contracts/WitOracleBaseQueriableUpgradable.json +1 -1
- package/build/contracts/WitOracleDataLib.json +2 -254
- package/build/contracts/WitOraclePushOnly.json +1 -1
- package/build/contracts/WitOracleRadonEncodingLib.json +2 -13
- package/build/contracts/WitOracleRadonRegistry.json +2 -13
- package/build/contracts/WitOracleRadonRegistryBase.json +1 -1
- package/build/contracts/WitOracleRadonRegistryBaseUpgradable.json +1 -1
- package/build/contracts/WitOracleRadonRegistryData.json +1 -1
- package/build/contracts/WitOracleRadonRegistryDefaultV21.json +1 -1
- package/build/contracts/WitOracleRadonRegistryUpgradableDefault.json +2 -17
- package/build/contracts/WitOracleRadonRegistryUpgradableNoSha256.json +1 -1
- package/build/contracts/WitOracleRadonRegistryUpgradableZkSync.json +1 -1
- package/build/contracts/WitOracleRadonRequestFactory.json +2 -13
- package/build/contracts/WitOracleRadonRequestFactoryBase.json +1 -1
- package/build/contracts/WitOracleRadonRequestFactoryBaseUpgradable.json +1 -1
- package/build/contracts/WitOracleRadonRequestFactoryModals.json +2 -13
- package/build/contracts/WitOracleRadonRequestFactoryModalsDefault.json +2 -13
- package/build/contracts/WitOracleRadonRequestFactoryTemplates.json +2 -13
- package/build/contracts/WitOracleRadonRequestFactoryTemplatesDefault.json +2 -13
- package/build/contracts/WitOracleRadonRequestFactoryUpgradableConfluxCore.json +1 -1
- package/build/contracts/WitOracleRadonRequestFactoryUpgradableDefault.json +2 -13
- package/build/contracts/WitOracleResultStatusLib.json +2 -14
- package/build/contracts/WitOracleTrustableDefault.json +2 -259
- package/build/contracts/WitOracleTrustableExperimental.json +1 -1
- package/build/contracts/WitOracleTrustableObscuro.json +1 -1
- package/build/contracts/WitOracleTrustableOvm2.json +1 -1
- package/build/contracts/WitOracleTrustablePushOnly.json +1 -1
- package/build/contracts/WitOracleTrustableReef.json +1 -1
- package/build/contracts/WitOracleTrustableZkSync.json +1 -1
- package/build/contracts/WitOracleTrustlessDataLib.json +1 -1
- package/build/contracts/WitOracleTrustlessDefaultV22.json +1 -1
- package/build/contracts/WitOracleTrustlessUpgradableDefault.json +1 -1
- package/build/contracts/WitPriceFeeds.json +2 -13
- package/build/contracts/WitPriceFeedsDataLib.json +2 -14
- package/build/contracts/WitPriceFeedsLegacy.json +2 -8
- package/build/contracts/WitPriceFeedsLegacyDataLib.json +2 -84
- package/build/contracts/WitPriceFeedsLegacyUpgradable.json +1 -1
- package/build/contracts/WitPriceFeedsLegacyUpgradableBypass.json +2 -80
- package/build/contracts/WitPriceFeedsSolverBase.json +1 -1
- package/build/contracts/WitPriceFeedsV3.json +1 -1
- package/build/contracts/WitPriceFeedsV3Upgradable.json +2 -17
- package/build/contracts/WitPythChainlinkAggregator.json +1 -1
- package/build/contracts/WitRandomness.json +2 -13
- package/build/contracts/WitRandomnessLegacy.json +1 -1
- package/build/contracts/WitRandomnessV3.json +2 -13
- package/build/contracts/WitRngConsumer.json +1 -1
- package/build/contracts/Witnet.json +1 -1
- package/build/contracts/WitnetBuffer.json +1 -1
- package/build/contracts/WitnetCBOR.json +1 -1
- package/build/contracts/WitnetDeployer.json +2 -13
- package/build/contracts/WitnetDeployerConfluxCore.json +1 -1
- package/build/contracts/WitnetDeployerDeferred.json +1 -1
- package/build/contracts/WitnetDeployerMeter.json +1 -1
- package/build/contracts/WitnetProxy.json +2 -9
- package/build/contracts/WitnetUpgradableBase.json +1 -1
- package/{migrations → dist/migrations}/addresses.json +1 -25
- package/{migrations → dist/migrations}/constructorArgs.json +1 -6
- package/dist/migrations/settings/artifacts.d.ts +95 -0
- package/dist/migrations/settings/artifacts.d.ts.map +1 -0
- package/dist/migrations/settings/artifacts.js +80 -0
- package/dist/migrations/settings/networks.d.ts +593 -0
- package/dist/migrations/settings/networks.d.ts.map +1 -0
- package/dist/migrations/settings/networks.js +593 -0
- package/dist/src/bin/helpers.cjs +350 -0
- package/dist/src/bin/helpers.d.cts +76 -0
- package/dist/src/bin/helpers.d.cts.map +1 -0
- package/dist/src/index.d.ts +6 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +33 -0
- package/dist/src/lib/types.d.ts +99 -0
- package/dist/src/lib/types.d.ts.map +1 -0
- package/dist/src/lib/types.js +18 -0
- package/dist/src/lib/utils.d.ts +22 -0
- package/dist/src/lib/utils.d.ts.map +1 -0
- package/dist/src/lib/utils.js +267 -0
- package/dist/src/lib/wrappers/ContractWrapper.d.ts +47 -0
- package/dist/src/lib/wrappers/ContractWrapper.d.ts.map +1 -0
- package/dist/src/lib/wrappers/ContractWrapper.js +81 -0
- package/dist/src/lib/wrappers/WitAppliance.d.ts +7 -0
- package/dist/src/lib/wrappers/WitAppliance.d.ts.map +1 -0
- package/dist/src/lib/wrappers/WitAppliance.js +17 -0
- package/dist/src/lib/wrappers/WitArtifact.d.ts +6 -0
- package/dist/src/lib/wrappers/WitArtifact.d.ts.map +1 -0
- package/dist/src/lib/wrappers/WitArtifact.js +16 -0
- package/dist/src/lib/wrappers/WitOracle.d.ts +105 -0
- package/dist/src/lib/wrappers/WitOracle.d.ts.map +1 -0
- package/dist/src/lib/wrappers/WitOracle.js +217 -0
- package/dist/src/lib/wrappers/WitOracleConsumer.d.ts +16 -0
- package/dist/src/lib/wrappers/WitOracleConsumer.d.ts.map +1 -0
- package/dist/src/lib/wrappers/WitOracleConsumer.js +30 -0
- package/dist/src/lib/wrappers/WitOracleRadonRegistry.d.ts +102 -0
- package/dist/src/lib/wrappers/WitOracleRadonRegistry.d.ts.map +1 -0
- package/dist/src/lib/wrappers/WitOracleRadonRegistry.js +140 -0
- package/dist/src/lib/wrappers/WitOracleRadonRequestFactory.d.ts +81 -0
- package/dist/src/lib/wrappers/WitOracleRadonRequestFactory.d.ts.map +1 -0
- package/dist/src/lib/wrappers/WitOracleRadonRequestFactory.js +257 -0
- package/dist/src/lib/wrappers/WitPriceFeeds.d.ts +91 -0
- package/dist/src/lib/wrappers/WitPriceFeeds.d.ts.map +1 -0
- package/dist/src/lib/wrappers/WitPriceFeeds.js +356 -0
- package/dist/src/lib/wrappers/WitPriceFeedsLegacy.d.ts +14 -0
- package/dist/src/lib/wrappers/WitPriceFeedsLegacy.d.ts.map +1 -0
- package/dist/src/lib/wrappers/WitPriceFeedsLegacy.js +64 -0
- package/dist/src/lib/wrappers/WitRandomness.d.ts +55 -0
- package/dist/src/lib/wrappers/WitRandomness.d.ts.map +1 -0
- package/dist/src/lib/wrappers/WitRandomness.js +165 -0
- package/dist/src/lib/wrappers.d.ts +8 -0
- package/dist/src/lib/wrappers.d.ts.map +1 -0
- package/dist/src/lib/wrappers.js +8 -0
- package/package.json +78 -54
- package/scripts/clean.cjs +21 -0
- package/scripts/eth-create2.cjs +38 -0
- package/scripts/eth-create3.cjs +45 -0
- package/scripts/postinstall.cjs +9 -0
- package/scripts/prepare.cjs +27 -0
- package/scripts/vanity2gen.cjs +121 -0
- package/scripts/vanity3gen.cjs +84 -0
- package/scripts/verify-proxies.cjs +50 -0
- package/scripts/verify-truffle.cjs +69 -0
- package/scripts/verify.js +95 -0
- package/scripts/wof-acls.js +17 -0
- package/src/bin/bots/bridge.cjs +0 -0
- package/src/bin/bots/randomizer.cjs +290 -0
- package/src/bin/bots/reporter.cjs +0 -0
- package/src/bin/cli/accounts.cjs +47 -0
- package/src/bin/cli/assets.cjs +466 -0
- package/src/bin/cli/framework.cjs +100 -0
- package/src/bin/cli/gateway.cjs +26 -0
- package/src/bin/cli/networks.cjs +63 -0
- package/src/bin/cli/priceFeeds.cjs +170 -0
- package/src/bin/cli/queries.cjs +217 -0
- package/src/bin/cli/randomness.cjs +367 -0
- package/src/bin/cli/reports.cjs +272 -0
- package/src/bin/cli/wizard.cjs +352 -0
- package/src/bin/helpers.cjs +388 -0
- package/src/bin/index.cjs +407 -0
- package/settings/artifacts.js +0 -71
- package/settings/index.js +0 -49
- package/settings/networks.js +0 -593
- package/settings/solidity.js +0 -11
- package/settings/specs.js +0 -102
- package/src/index.js +0 -96
- package/src/utils.js +0 -305
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
const fs = require("node:fs")
|
|
2
|
+
|
|
3
|
+
const create2 = require("./eth-create2.cjs")
|
|
4
|
+
const utils = require("../src/utils.js").default
|
|
5
|
+
|
|
6
|
+
const addresses = require("../migrations/addresses.json")
|
|
7
|
+
const constructorArgs = require("../migrations/constructorArgs.json")
|
|
8
|
+
|
|
9
|
+
module.exports = async () => {
|
|
10
|
+
let artifactName
|
|
11
|
+
let count = 0
|
|
12
|
+
let from
|
|
13
|
+
let hits = 10
|
|
14
|
+
let offset = 0
|
|
15
|
+
let network = "default"
|
|
16
|
+
let prefix = "0x00"
|
|
17
|
+
let suffix = "00"
|
|
18
|
+
let hexArgs = ""
|
|
19
|
+
process.argv.map((argv, index, args) => {
|
|
20
|
+
if (argv === "--offset") {
|
|
21
|
+
offset = parseInt(args[index + 1], 10)
|
|
22
|
+
} else if (argv === "--artifact") {
|
|
23
|
+
artifactName = args[index + 1]
|
|
24
|
+
} else if (argv === "--prefix") {
|
|
25
|
+
prefix = args[index + 1].toLowerCase()
|
|
26
|
+
if (!web3.utils.isHexStrict(prefix)) {
|
|
27
|
+
throw new Error("--prefix: invalid hex string")
|
|
28
|
+
}
|
|
29
|
+
} else if (argv === "--suffix") {
|
|
30
|
+
suffix = args[index + 1].toLowerCase()
|
|
31
|
+
if (!web3.utils.isHexStrict(suffix)) {
|
|
32
|
+
throw new Error("--suffix: invalid hex string")
|
|
33
|
+
}
|
|
34
|
+
} else if (argv === "--hits") {
|
|
35
|
+
hits = parseInt(args[index + 1], 10)
|
|
36
|
+
} else if (argv === "--network") {
|
|
37
|
+
;[, network] = utils.getRealmNetworkFromString(
|
|
38
|
+
args[index + 1].toLowerCase(),
|
|
39
|
+
)
|
|
40
|
+
} else if (argv === "--hexArgs") {
|
|
41
|
+
hexArgs = args[index + 1].toLowerCase()
|
|
42
|
+
if (hexArgs.startsWith("0x")) hexArgs = hexArgs.slice(2)
|
|
43
|
+
if (!web3.utils.isHexStrict(`0x${hexArgs}`)) {
|
|
44
|
+
throw new Error("--hexArgs: invalid hex string")
|
|
45
|
+
}
|
|
46
|
+
} else if (argv === "--from") {
|
|
47
|
+
from = args[index + 1]
|
|
48
|
+
}
|
|
49
|
+
return argv
|
|
50
|
+
})
|
|
51
|
+
if (hexArgs === "" && artifactName !== "") {
|
|
52
|
+
hexArgs = constructorArgs[network][artifactName]
|
|
53
|
+
if (!hexArgs) {
|
|
54
|
+
console.error("No --hexArgs was set!")
|
|
55
|
+
exit()
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
from =
|
|
59
|
+
from ||
|
|
60
|
+
addresses[network]?.WitnetDeployer ||
|
|
61
|
+
addresses.default?.WitnetDeployer
|
|
62
|
+
if (!from) {
|
|
63
|
+
console.error("No --from was set!")
|
|
64
|
+
exit()
|
|
65
|
+
}
|
|
66
|
+
if (hexArgs === "" && artifactName !== "") {
|
|
67
|
+
console.log(
|
|
68
|
+
network,
|
|
69
|
+
constructorArgs[network],
|
|
70
|
+
constructorArgs[network][artifactName],
|
|
71
|
+
)
|
|
72
|
+
hexArgs = constructorArgs[network][artifactName]
|
|
73
|
+
if (!hexArgs) {
|
|
74
|
+
console.error("No --hexArgs was set!")
|
|
75
|
+
exit()
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (!artifactName) {
|
|
79
|
+
console.error("No --artifact was set!")
|
|
80
|
+
process.exit(1)
|
|
81
|
+
}
|
|
82
|
+
const artifact = artifacts.require(artifactName)
|
|
83
|
+
const initCode = artifact.toJSON().bytecode + hexArgs
|
|
84
|
+
console.log("Init code: ", initCode)
|
|
85
|
+
console.log("Artifact: ", artifact?.contractName)
|
|
86
|
+
console.log("From: ", from)
|
|
87
|
+
console.log("Hits: ", hits)
|
|
88
|
+
console.log("Offset: ", offset)
|
|
89
|
+
console.log("Prefix: ", prefix)
|
|
90
|
+
console.log("Suffix: ", suffix)
|
|
91
|
+
console.log("=".repeat(55))
|
|
92
|
+
suffix = suffix.slice(2)
|
|
93
|
+
while (count < hits) {
|
|
94
|
+
const salt = `0x${utils.padLeft(offset.toString(16), "0", 32)}`
|
|
95
|
+
const addr = create2(from, salt, initCode).toLowerCase()
|
|
96
|
+
if (addr.startsWith(prefix) && addr.endsWith(suffix)) {
|
|
97
|
+
const found = `${offset} => ${web3.utils.toChecksumAddress(addr)}`
|
|
98
|
+
console.log(found)
|
|
99
|
+
fs.appendFileSync(
|
|
100
|
+
`./migrations/salts/${artifact?.contractName}$${from.toLowerCase()}.tmp`,
|
|
101
|
+
`${found}\n`,
|
|
102
|
+
)
|
|
103
|
+
count++
|
|
104
|
+
}
|
|
105
|
+
offset++
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function exit() {
|
|
110
|
+
console.info("Usage:\n")
|
|
111
|
+
console.info(" --artifact => Truffle artifact name (mandatory)")
|
|
112
|
+
console.info(" --hexArgs => Hexified constructor arguments")
|
|
113
|
+
console.info(
|
|
114
|
+
" --hits => Number of vanity hits to look for (default: 10)",
|
|
115
|
+
)
|
|
116
|
+
console.info(" --network => Network name")
|
|
117
|
+
console.info(" --offset => Salt starting value minus 1 (default: 0)")
|
|
118
|
+
console.info(" --prefix => Prefix hex string to look for (default: 0x00)")
|
|
119
|
+
console.info(" --suffix => suffix hex string to look for (default: 0x00)")
|
|
120
|
+
process.exit(1)
|
|
121
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
const fs = require("node:fs")
|
|
2
|
+
|
|
3
|
+
const create3 = require("./eth-create3.cjs")
|
|
4
|
+
const utils = require("../src/utils.js").default
|
|
5
|
+
|
|
6
|
+
const addresses = require("../migrations/addresses")
|
|
7
|
+
|
|
8
|
+
module.exports = async () => {
|
|
9
|
+
let count = 0
|
|
10
|
+
let from
|
|
11
|
+
let hits = 10
|
|
12
|
+
let offset = 0
|
|
13
|
+
let network = "default"
|
|
14
|
+
let prefix = "0x00"
|
|
15
|
+
let suffix = "0x00"
|
|
16
|
+
process.argv.map((argv, index, args) => {
|
|
17
|
+
if (argv === "--offset") {
|
|
18
|
+
offset = parseInt(args[index + 1], 10)
|
|
19
|
+
} else if (argv === "--prefix") {
|
|
20
|
+
prefix = args[index + 1].toLowerCase()
|
|
21
|
+
if (!web3.utils.isHexStrict(prefix)) {
|
|
22
|
+
throw Error("--prefix: invalid hex string")
|
|
23
|
+
}
|
|
24
|
+
} else if (argv === "--suffix") {
|
|
25
|
+
suffix = args[index + 1].toLowerCase()
|
|
26
|
+
if (!web3.utils.isHexStrict(suffix)) {
|
|
27
|
+
throw Error("--suffix: invalid hex string")
|
|
28
|
+
}
|
|
29
|
+
} else if (argv === "--hits") {
|
|
30
|
+
hits = parseInt(args[index + 1], 10)
|
|
31
|
+
} else if (argv === "--network") {
|
|
32
|
+
;[, network] = utils.getRealmNetworkFromString(
|
|
33
|
+
args[index + 1].toLowerCase(),
|
|
34
|
+
)
|
|
35
|
+
} else if (argv === "--from") {
|
|
36
|
+
from = args[index + 1]
|
|
37
|
+
}
|
|
38
|
+
return argv
|
|
39
|
+
})
|
|
40
|
+
try {
|
|
41
|
+
from =
|
|
42
|
+
from ||
|
|
43
|
+
addresses[network]?.WitnetDeployer ||
|
|
44
|
+
addresses.default.WitnetDeployer
|
|
45
|
+
} catch {
|
|
46
|
+
console.error(
|
|
47
|
+
`WitnetDeployer must have been previously deployed on network '${network}'.\n`,
|
|
48
|
+
)
|
|
49
|
+
console.info("Usage:\n")
|
|
50
|
+
console.info(
|
|
51
|
+
" --hits => Number of vanity hits to look for (default: 10)",
|
|
52
|
+
)
|
|
53
|
+
console.info(" --network => Network name")
|
|
54
|
+
console.info(" --offset => Salt starting value minus 1 (default: 0)")
|
|
55
|
+
console.info(
|
|
56
|
+
" --prefix => Prefix hex string to look for (default: 0x00)",
|
|
57
|
+
)
|
|
58
|
+
console.info(
|
|
59
|
+
" --suffix => suffix hex string to look for (default: 0x00)",
|
|
60
|
+
)
|
|
61
|
+
process.exit(1)
|
|
62
|
+
}
|
|
63
|
+
console.log("From: ", from)
|
|
64
|
+
console.log("Hits: ", hits)
|
|
65
|
+
console.log("Offset: ", offset)
|
|
66
|
+
console.log("Prefix: ", prefix)
|
|
67
|
+
console.log("Suffix: ", suffix)
|
|
68
|
+
console.log("=".repeat(55))
|
|
69
|
+
suffix = suffix.slice(2)
|
|
70
|
+
while (count < hits) {
|
|
71
|
+
const salt = `0x${utils.padLeft(offset.toString(16), "0", 32)}`
|
|
72
|
+
const addr = create3(from, salt).toLowerCase()
|
|
73
|
+
if (addr.startsWith(prefix) && addr.endsWith(suffix)) {
|
|
74
|
+
const found = `${offset} => ${web3.utils.toChecksumAddress(addr)}`
|
|
75
|
+
console.log(found)
|
|
76
|
+
fs.appendFileSync(
|
|
77
|
+
`./migrations/salts/create3$${from.toLowerCase()}.tmp`,
|
|
78
|
+
`${found}\n`,
|
|
79
|
+
)
|
|
80
|
+
count++
|
|
81
|
+
}
|
|
82
|
+
offset++
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const addresses = require("../migrations/addresses.json")
|
|
4
|
+
const _constructorArgs = require("../migrations/constructorArgs.json")
|
|
5
|
+
const settings = require("../settings/index.js").default
|
|
6
|
+
const utils = require("../src/utils.js").default
|
|
7
|
+
|
|
8
|
+
if (process.argv.length < 3) {
|
|
9
|
+
console.error(
|
|
10
|
+
"\nUsage:\n\n$ node ./scripts/verify-core.js <ecosystem>:<network> ...OPTIONAL_ARGS\n",
|
|
11
|
+
)
|
|
12
|
+
process.exit(0)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const network = process.argv[2].toLowerCase().replaceAll(".", ":")
|
|
16
|
+
const networkArtifacts = settings.getArtifacts(network)
|
|
17
|
+
|
|
18
|
+
utils.traceVerifyTruffle(
|
|
19
|
+
network,
|
|
20
|
+
`${networkArtifacts?.WitnetDeployer} --forceConstructorArgs string: --verifiers etherscan,sourcify`,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
const framework = {
|
|
24
|
+
libs: networkArtifacts.libs,
|
|
25
|
+
core: networkArtifacts.core,
|
|
26
|
+
apps: networkArtifacts.apps,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
for (const domain in framework) {
|
|
30
|
+
const header = `${network.toUpperCase()} ${domain.toUpperCase()}`
|
|
31
|
+
console.info()
|
|
32
|
+
console.info(header)
|
|
33
|
+
console.info("=".repeat(header.length))
|
|
34
|
+
console.info()
|
|
35
|
+
for (const base in framework[domain]) {
|
|
36
|
+
const impl = framework[domain][base]
|
|
37
|
+
if (utils.isUpgradableArtifact(impl)) {
|
|
38
|
+
const addr = utils.getNetworkArtifactAddress(
|
|
39
|
+
network,
|
|
40
|
+
domain,
|
|
41
|
+
addresses,
|
|
42
|
+
base,
|
|
43
|
+
)
|
|
44
|
+
utils.traceVerifyTruffle(
|
|
45
|
+
network,
|
|
46
|
+
`WitnetProxy@${addr} --custom-proxy WitnetProxy`,
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const addresses = require("../migrations/addresses.json")
|
|
4
|
+
const constructorArgs = require("../migrations/constructorArgs.json")
|
|
5
|
+
const settings = require("../settings/index.js").default
|
|
6
|
+
const utils = require("../src/utils.js").default
|
|
7
|
+
|
|
8
|
+
const web3 = require("web3")
|
|
9
|
+
|
|
10
|
+
if (process.argv.length < 3) {
|
|
11
|
+
console.error(
|
|
12
|
+
"\nUsage:\n\n$ node ./scripts/verify-core.js <ecosystem>:<network> ...OPTIONAL_ARGS\n",
|
|
13
|
+
)
|
|
14
|
+
process.exit(0)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const network = process.argv[2].toLowerCase().replaceAll(".", ":")
|
|
18
|
+
const networkArtifacts = settings.getArtifacts(network)
|
|
19
|
+
|
|
20
|
+
utils.traceVerifyTruffle(
|
|
21
|
+
network,
|
|
22
|
+
`${networkArtifacts?.WitnetDeployer} --forceConstructorArgs string: --verifiers etherscan,sourcify`,
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
const framework = {
|
|
26
|
+
libs: networkArtifacts.libs,
|
|
27
|
+
core: networkArtifacts.core,
|
|
28
|
+
apps: networkArtifacts.apps,
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
for (const domain in framework) {
|
|
32
|
+
const header = `${network.toUpperCase()} ${domain.toUpperCase()}`
|
|
33
|
+
console.info()
|
|
34
|
+
console.info(header)
|
|
35
|
+
console.info("=".repeat(header.length))
|
|
36
|
+
console.info()
|
|
37
|
+
for (const base in framework[domain]) {
|
|
38
|
+
const impl = framework[domain][base]
|
|
39
|
+
if (utils.isUpgradableArtifact(impl)) {
|
|
40
|
+
const addr = utils.getNetworkArtifactAddress(
|
|
41
|
+
network,
|
|
42
|
+
domain,
|
|
43
|
+
addresses,
|
|
44
|
+
base,
|
|
45
|
+
)
|
|
46
|
+
utils.traceVerifyTruffle(
|
|
47
|
+
network,
|
|
48
|
+
`WitnetProxy@${addr} --custom-proxy WitnetProxy`,
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
const forceConstructorArgs =
|
|
52
|
+
constructorArgs[network][impl] || constructorArgs?.default[impl]
|
|
53
|
+
if (forceConstructorArgs) {
|
|
54
|
+
const args = JSON.parse(forceConstructorArgs)
|
|
55
|
+
const encodedArgs = web3.eth.abi
|
|
56
|
+
.encodeParameters(args.types, args.values)
|
|
57
|
+
.slice(2)
|
|
58
|
+
utils.traceVerifyTruffle(
|
|
59
|
+
network,
|
|
60
|
+
`${impl} --forceConstructorArgs string:${encodedArgs} --verifiers etherscan,sourcify`,
|
|
61
|
+
)
|
|
62
|
+
} else {
|
|
63
|
+
utils.traceVerifyTruffle(
|
|
64
|
+
network,
|
|
65
|
+
`${impl} --verifiers etherscan,sourcify`,
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { createRequire } from "node:module"
|
|
4
|
+
import { verifyContract } from "@nomicfoundation/hardhat-verify/verify"
|
|
5
|
+
import hre from "hardhat"
|
|
6
|
+
import merge from "lodash.merge"
|
|
7
|
+
|
|
8
|
+
const require = createRequire(import.meta.url)
|
|
9
|
+
const addresses = require("../migrations/addresses.json")
|
|
10
|
+
const constructorArgs = require("../migrations/constructorArgs.json")
|
|
11
|
+
|
|
12
|
+
import { default as settings } from "../settings/index.js"
|
|
13
|
+
import { default as utils } from "../src/utils.js"
|
|
14
|
+
|
|
15
|
+
const network = spliceFromArgs(process.argv, "--network")
|
|
16
|
+
const networkArtifacts = settings.getArtifacts(network)
|
|
17
|
+
|
|
18
|
+
async function main() {
|
|
19
|
+
const framework = {
|
|
20
|
+
libs: networkArtifacts.libs,
|
|
21
|
+
core: networkArtifacts.core,
|
|
22
|
+
apps: networkArtifacts.apps,
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
for (const domain in framework) {
|
|
26
|
+
const _header = `${network.toUpperCase()} ${domain.toUpperCase()}`
|
|
27
|
+
for (const base in framework[domain]) {
|
|
28
|
+
const impl = framework[domain][base]
|
|
29
|
+
let headline
|
|
30
|
+
if (utils.isUpgradableArtifact(impl)) {
|
|
31
|
+
// verify proxy
|
|
32
|
+
const address = utils.getNetworkArtifactAddress(
|
|
33
|
+
network,
|
|
34
|
+
domain,
|
|
35
|
+
addresses,
|
|
36
|
+
base,
|
|
37
|
+
)
|
|
38
|
+
headline = `> Verifying proxy for ${base}...`
|
|
39
|
+
console.info(`\n${"=".repeat(100)}\n${headline}`)
|
|
40
|
+
try {
|
|
41
|
+
await verifyContract(
|
|
42
|
+
{ address, contract: "contracts/core/WitnetProxy.sol:WitnetProxy" },
|
|
43
|
+
hre,
|
|
44
|
+
)
|
|
45
|
+
} catch (err) {
|
|
46
|
+
console.error(err)
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
// verify logic
|
|
50
|
+
const address = utils.getNetworkArtifactAddress(
|
|
51
|
+
network,
|
|
52
|
+
domain,
|
|
53
|
+
addresses,
|
|
54
|
+
impl,
|
|
55
|
+
)
|
|
56
|
+
if (!address) {
|
|
57
|
+
headline = `> SKIPPED: ${impl}`
|
|
58
|
+
console.info(`\n${"=".repeat(100)}\n${headline}`)
|
|
59
|
+
} else {
|
|
60
|
+
headline = `> Verifying ${impl}...`
|
|
61
|
+
console.info(`\n${"=".repeat(100)}\n${headline}`)
|
|
62
|
+
const args = (
|
|
63
|
+
constructorArgs[network][impl] || constructorArgs.default[impl]
|
|
64
|
+
? merge(
|
|
65
|
+
JSON.parse(constructorArgs[network][impl] || "[]"),
|
|
66
|
+
JSON.parse(constructorArgs.default[impl] || "[]"),
|
|
67
|
+
)
|
|
68
|
+
: undefined
|
|
69
|
+
)?.values
|
|
70
|
+
if (args) {
|
|
71
|
+
console.info(` Constructor args: ${JSON.stringify(args)}`)
|
|
72
|
+
}
|
|
73
|
+
try {
|
|
74
|
+
await verifyContract({ address, constructorArgs: args }, hre)
|
|
75
|
+
} catch (err) {
|
|
76
|
+
console.error(err)
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function spliceFromArgs(args, flag) {
|
|
84
|
+
const argIndex = args.indexOf(flag)
|
|
85
|
+
if (argIndex >= 0 && args.length > argIndex + 1) {
|
|
86
|
+
const value = args[argIndex + 1]
|
|
87
|
+
args.splice(argIndex, 2)
|
|
88
|
+
return value
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
main().catch((err) => {
|
|
93
|
+
console.error(err)
|
|
94
|
+
process.exitCode = 1
|
|
95
|
+
})
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { createRequire } from "node:module"
|
|
4
|
+
import hre from "hardhat"
|
|
5
|
+
|
|
6
|
+
const require = createRequire(import.meta.url)
|
|
7
|
+
const _addresses = require("../migrations/addresses.json")
|
|
8
|
+
|
|
9
|
+
import { utils } from "../dist/src/index.js"
|
|
10
|
+
|
|
11
|
+
async function main() {
|
|
12
|
+
const { network } = hre
|
|
13
|
+
console.log(network)
|
|
14
|
+
console.log(utils.getEvmNetworkAddresses(hre.network))
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
main()
|
|
File without changes
|