@mapprotocol/common-contracts 0.4.2 → 0.4.3
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/package.json +1 -1
- package/utils/dist/verifier.d.ts +7 -0
- package/utils/dist/verifier.js +2 -2
- package/utils/verifier.ts +9 -2
package/package.json
CHANGED
package/utils/dist/verifier.d.ts
CHANGED
|
@@ -17,6 +17,13 @@ export interface VerifyOptions {
|
|
|
17
17
|
compiler?: string;
|
|
18
18
|
optimizer?: boolean;
|
|
19
19
|
optimizerRuns?: number;
|
|
20
|
+
/**
|
|
21
|
+
* Reuse an existing verify-output/<contract>_flatten.sol instead of regenerating it.
|
|
22
|
+
* Off by default: the flatten is always regenerated from current source, because a
|
|
23
|
+
* cached file keyed only on the contract name silently verifies STALE source after
|
|
24
|
+
* the contract changes. Only enable this when you intentionally hand-edited the flatten.
|
|
25
|
+
*/
|
|
26
|
+
reuseFlatten?: boolean;
|
|
20
27
|
}
|
|
21
28
|
/**
|
|
22
29
|
* Unified contract verification — auto-routes to EVM (hardhat verify) or Tron (TronScan API)
|
package/utils/dist/verifier.js
CHANGED
|
@@ -81,8 +81,8 @@ async function verifyTron(hre, opts) {
|
|
|
81
81
|
// Generate flattened source
|
|
82
82
|
const outputDir = path.join(process.cwd(), "verify-output");
|
|
83
83
|
const flattenPath = path.join(outputDir, `${opts.contractName}_flatten.sol`);
|
|
84
|
-
if (fs.existsSync(flattenPath)) {
|
|
85
|
-
console.log(`
|
|
84
|
+
if (opts.reuseFlatten && fs.existsSync(flattenPath)) {
|
|
85
|
+
console.log(`reusing existing flatten: ${flattenPath}`);
|
|
86
86
|
}
|
|
87
87
|
else {
|
|
88
88
|
console.log(`generating flatten for ${opts.contractName}...`);
|
package/utils/verifier.ts
CHANGED
|
@@ -29,6 +29,13 @@ export interface VerifyOptions {
|
|
|
29
29
|
compiler?: string; // override solc version (auto-read from build-info if omitted)
|
|
30
30
|
optimizer?: boolean; // override optimizer enabled (auto-read from build-info if omitted)
|
|
31
31
|
optimizerRuns?: number; // override optimizer runs (auto-read from build-info if omitted)
|
|
32
|
+
/**
|
|
33
|
+
* Reuse an existing verify-output/<contract>_flatten.sol instead of regenerating it.
|
|
34
|
+
* Off by default: the flatten is always regenerated from current source, because a
|
|
35
|
+
* cached file keyed only on the contract name silently verifies STALE source after
|
|
36
|
+
* the contract changes. Only enable this when you intentionally hand-edited the flatten.
|
|
37
|
+
*/
|
|
38
|
+
reuseFlatten?: boolean;
|
|
32
39
|
}
|
|
33
40
|
|
|
34
41
|
/**
|
|
@@ -108,8 +115,8 @@ async function verifyTron(hre: any, opts: VerifyOptions): Promise<void> {
|
|
|
108
115
|
const outputDir = path.join(process.cwd(), "verify-output");
|
|
109
116
|
const flattenPath = path.join(outputDir, `${opts.contractName}_flatten.sol`);
|
|
110
117
|
|
|
111
|
-
if (fs.existsSync(flattenPath)) {
|
|
112
|
-
console.log(`
|
|
118
|
+
if (opts.reuseFlatten && fs.existsSync(flattenPath)) {
|
|
119
|
+
console.log(`reusing existing flatten: ${flattenPath}`);
|
|
113
120
|
} else {
|
|
114
121
|
console.log(`generating flatten for ${opts.contractName}...`);
|
|
115
122
|
let sourcePath = "";
|