@xtools-at/hardhat-sourcify
Version:
Improved fork of zoey-t's Sourcify contract verification plugin for Hardhat
59 lines • 3.12 kB
JavaScript
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const config_1 = require("hardhat/config");
const types = __importStar(require("hardhat/internal/core/params/argumentTypes"));
const sourcify_1 = require("./sourcify");
// This import is needed to let the TypeScript compiler know that it should include your type
// extensions in your npm package's types file.
require("./type-extensions");
(0, config_1.task)("verify-sourcify", "verify contract using sourcify")
.addOptionalParam("contract", "Name of the contract you want to verify (e.g. `Greeter`)", undefined, types.string)
.addParam("address", "Address of the contract", undefined, types.string)
.addOptionalParam("path", "Path to contract in default contract folder, e.g `extensions/Foo.sol` or `extensions` (for 'contracts/extensions/Greeter.sol'). Can be omitted if filename is the same as `contractName`, and file isn't in a subfolder. ", undefined, types.string)
.addOptionalParam("fullPath", "Full relative path to contract, e.g `contracts-custom/Greeter.sol`. Overrides `path` completely", undefined, types.string)
.addOptionalParam("chainId", "The chainId of the network that your contract deployed on, if `--network` isn't used", undefined, types.string)
.addOptionalParam("endpoint", "Endpoint url for Sourcify", undefined, types.string)
.addOptionalParam("contractName", "Legacy param for `contract`, do not use", undefined, types.string)
.addOptionalParam("sourceName", "Legacy param for `full-path`, do not use", undefined, types.string)
.setAction(async (args, hre) => {
// compile contracts first
await hre.run("compile");
const { endpoint, fullPath, path, contract, address, chainId, contractName, sourceName } = args;
await (0, sourcify_1.submitSourcesToSourcify)(hre, {
contract,
address,
path,
fullPath,
chainId,
endpoint,
contractName,
sourceName,
}).catch((error) => {
console.error(error);
process.exitCode = 1;
});
});
//# sourceMappingURL=index.js.map
;