@layerzerolabs/verify-contract 1.1.6 → 1.1.8
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/cli/index.js +1 -1
- package/dist/index.js +68 -64
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +68 -64
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -64326,13 +64326,21 @@ var source_default2 = got;
|
|
|
64326
64326
|
|
|
64327
64327
|
// src/common/etherscan.ts
|
|
64328
64328
|
var Verification = class extends EventEmitter {
|
|
64329
|
-
constructor(props) {
|
|
64329
|
+
constructor(props, logger11) {
|
|
64330
64330
|
super();
|
|
64331
64331
|
this.props = props;
|
|
64332
|
+
this.logger = logger11;
|
|
64332
64333
|
}
|
|
64333
64334
|
async verify() {
|
|
64334
64335
|
try {
|
|
64336
|
+
this.logger.verbose(
|
|
64337
|
+
`Submitting verification for ${this.props.contractName} on address ${this.props.address} to ${this.props.apiUrl}`
|
|
64338
|
+
);
|
|
64335
64339
|
const response = await this.__submit();
|
|
64340
|
+
this.logger.verbose(
|
|
64341
|
+
`Received response for ${this.props.contractName} on address ${this.props.address} to ${this.props.apiUrl}`
|
|
64342
|
+
);
|
|
64343
|
+
this.logger.verbose(JSON.stringify(response));
|
|
64336
64344
|
if (isAlreadyVerifiedResult(response.result)) {
|
|
64337
64345
|
return {
|
|
64338
64346
|
alreadyVerified: true
|
|
@@ -64397,7 +64405,7 @@ var Verification = class extends EventEmitter {
|
|
|
64397
64405
|
}
|
|
64398
64406
|
}
|
|
64399
64407
|
};
|
|
64400
|
-
var createVerification = (props) => new Verification(props);
|
|
64408
|
+
var createVerification = (props, logger11) => new Verification(props, logger11);
|
|
64401
64409
|
var isPendingResult = (result) => !!(result == null ? void 0 : result.match(/Pending/gi));
|
|
64402
64410
|
var isAlreadyVerifiedResult = (result) => !!(result == null ? void 0 : result.match(/already verified/gi));
|
|
64403
64411
|
var isApiRateLimitedResult = (result) => !!(result == null ? void 0 : result.match(/rate/));
|
|
@@ -67860,7 +67868,6 @@ var verifyTarget = async (config, logger11) => {
|
|
|
67860
67868
|
deploymentAbsolutePath
|
|
67861
67869
|
).filter((fileName) => fileName.endsWith(".json"));
|
|
67862
67870
|
return deployedContractFileNames.flatMap((fileName) => {
|
|
67863
|
-
var _a;
|
|
67864
67871
|
logger11.info(
|
|
67865
67872
|
`Inspecting deployment file ${fileName} on network ${networkName}`
|
|
67866
67873
|
);
|
|
@@ -67876,68 +67883,64 @@ var verifyTarget = async (config, logger11) => {
|
|
|
67876
67883
|
);
|
|
67877
67884
|
}
|
|
67878
67885
|
const deployment = deploymentParseResult.data;
|
|
67879
|
-
|
|
67886
|
+
basename(fileName, ".json");
|
|
67880
67887
|
const compilationTargets = deployment.metadata.settings.compilationTarget;
|
|
67881
|
-
|
|
67882
|
-
(
|
|
67883
|
-
|
|
67884
|
-
|
|
67885
|
-
|
|
67886
|
-
|
|
67887
|
-
|
|
67888
|
-
|
|
67889
|
-
|
|
67890
|
-
|
|
67891
|
-
|
|
67892
|
-
|
|
67893
|
-
|
|
67894
|
-
|
|
67895
|
-
|
|
67896
|
-
|
|
67897
|
-
|
|
67898
|
-
|
|
67899
|
-
|
|
67900
|
-
|
|
67901
|
-
|
|
67902
|
-
|
|
67903
|
-
|
|
67904
|
-
|
|
67905
|
-
|
|
67906
|
-
|
|
67907
|
-
|
|
67908
|
-
|
|
67909
|
-
|
|
67910
|
-
|
|
67911
|
-
|
|
67888
|
+
return Object.entries(compilationTargets).flatMap(
|
|
67889
|
+
([compilationTarget, contractName2]) => {
|
|
67890
|
+
var _a;
|
|
67891
|
+
const shouldVerifyHardhatDeploy = verify(
|
|
67892
|
+
contractName2,
|
|
67893
|
+
compilationTarget,
|
|
67894
|
+
networkName
|
|
67895
|
+
);
|
|
67896
|
+
if (!shouldVerifyHardhatDeploy) {
|
|
67897
|
+
logger11.debug(
|
|
67898
|
+
`Not verifying ${contractName2} in ${fileName} on network ${networkName}`
|
|
67899
|
+
);
|
|
67900
|
+
return [];
|
|
67901
|
+
}
|
|
67902
|
+
const source = deployment.metadata.sources[compilationTarget];
|
|
67903
|
+
if (source == null) {
|
|
67904
|
+
logger11.error(
|
|
67905
|
+
COLORS.error`Could not find source for ${contractName2} (${compilationTarget})`
|
|
67906
|
+
);
|
|
67907
|
+
return [];
|
|
67908
|
+
}
|
|
67909
|
+
const licenseType = findLicenseType(source.content);
|
|
67910
|
+
const constructorArguments = encodeContructorArguments(
|
|
67911
|
+
deployment.abi,
|
|
67912
|
+
deployment.args
|
|
67913
|
+
);
|
|
67914
|
+
const solcInput = extractSolcInputFromMetadata(deployment.metadata);
|
|
67915
|
+
const submitProps = {
|
|
67916
|
+
apiUrl: networkConfig.apiUrl,
|
|
67917
|
+
apiKey: networkConfig.apiKey,
|
|
67918
|
+
address: deployment.address,
|
|
67919
|
+
contractName: `${compilationTarget}:${contractName2}`,
|
|
67920
|
+
constructorArguments,
|
|
67921
|
+
licenseType,
|
|
67922
|
+
compilerVersion: deployment.metadata.compiler.version,
|
|
67923
|
+
sourceCode: JSON.stringify(solcInput),
|
|
67924
|
+
evmVersion: deployment.metadata.settings.evmVersion,
|
|
67925
|
+
optimizerRuns: (_a = deployment.metadata.settings.optimizer) == null ? void 0 : _a.runs
|
|
67926
|
+
};
|
|
67927
|
+
recordLogger({
|
|
67928
|
+
Contract: contractName2,
|
|
67929
|
+
Network: networkName,
|
|
67930
|
+
Address: deployment.address,
|
|
67931
|
+
License: submitProps.licenseType,
|
|
67932
|
+
Arguments: JSON.stringify(deployment.args),
|
|
67933
|
+
Sources: Object.keys(deployment.metadata.sources),
|
|
67934
|
+
"Scan URL": submitProps.apiUrl,
|
|
67935
|
+
"Scan API Key": submitProps.apiKey ? anonymizeValue(submitProps.apiKey) : void 0
|
|
67936
|
+
});
|
|
67937
|
+
return {
|
|
67938
|
+
submitProps,
|
|
67939
|
+
networkName,
|
|
67940
|
+
networkConfig
|
|
67941
|
+
};
|
|
67942
|
+
}
|
|
67912
67943
|
);
|
|
67913
|
-
const solcInput = extractSolcInputFromMetadata(deployment.metadata);
|
|
67914
|
-
const submitProps = {
|
|
67915
|
-
apiUrl: networkConfig.apiUrl,
|
|
67916
|
-
apiKey: networkConfig.apiKey,
|
|
67917
|
-
address: deployment.address,
|
|
67918
|
-
contractName: `${compilationTarget}:${contractName}`,
|
|
67919
|
-
constructorArguments,
|
|
67920
|
-
licenseType,
|
|
67921
|
-
compilerVersion: deployment.metadata.compiler.version,
|
|
67922
|
-
sourceCode: JSON.stringify(solcInput),
|
|
67923
|
-
evmVersion: deployment.metadata.settings.evmVersion,
|
|
67924
|
-
optimizerRuns: (_a = deployment.metadata.settings.optimizer) == null ? void 0 : _a.runs
|
|
67925
|
-
};
|
|
67926
|
-
recordLogger({
|
|
67927
|
-
Contract: contractName,
|
|
67928
|
-
Network: networkName,
|
|
67929
|
-
Address: deployment.address,
|
|
67930
|
-
License: submitProps.licenseType,
|
|
67931
|
-
Arguments: JSON.stringify(deployment.args),
|
|
67932
|
-
Sources: Object.keys(deployment.metadata.sources),
|
|
67933
|
-
"Scan URL": submitProps.apiUrl,
|
|
67934
|
-
"Scan API Key": submitProps.apiKey ? anonymizeValue(submitProps.apiKey) : void 0
|
|
67935
|
-
});
|
|
67936
|
-
return {
|
|
67937
|
-
submitProps,
|
|
67938
|
-
networkName,
|
|
67939
|
-
networkConfig
|
|
67940
|
-
};
|
|
67941
67944
|
});
|
|
67942
67945
|
}
|
|
67943
67946
|
);
|
|
@@ -67964,13 +67967,14 @@ var createVerifyAll = (logger11) => (artifacts) => {
|
|
|
67964
67967
|
paletteColor`Verifying contract ${contractName} for network ${networkName} ${counter}`
|
|
67965
67968
|
);
|
|
67966
67969
|
try {
|
|
67967
|
-
const verification = createVerification(submitProps);
|
|
67970
|
+
const verification = createVerification(submitProps, logger11);
|
|
67968
67971
|
verification.on("poll", (guid) => {
|
|
67969
67972
|
logger11.info(
|
|
67970
67973
|
paletteColor`Polling for verification status of ${contractName} for network ${networkName} (GUID ${guid}) ${counter}`
|
|
67971
67974
|
);
|
|
67972
67975
|
});
|
|
67973
67976
|
verification.on("retry", (error, attempt) => {
|
|
67977
|
+
logger11.verbose(`Received an error: ${error}`);
|
|
67974
67978
|
logger11.info(
|
|
67975
67979
|
paletteColor`Retrying failed verification attempt of ${contractName} for network ${networkName} (attempt ${attempt + 1}) ${counter}`
|
|
67976
67980
|
);
|