hardhat-deploy
Version:
Hardhat plugin for replicable smart contract deployments and easy testing across multiple EVM chains, with support for proxies, diamonds, named accounts, and deployment fixtures
60 lines • 2.3 kB
JavaScript
import 'named-logs-console';
import { task } from 'hardhat/config';
import './type-extensions.js';
import { ArgumentType } from 'hardhat/types/arguments';
const hardhatPlugin = {
id: 'hardhat-deploy',
hookHandlers: {
config: () => import('./hook-handlers/config.js'),
solidity: () => import('./hook-handlers/solidity.js'),
},
tasks: [
task('deploy', 'Deploy contracts')
// .addFlag('skipGasReport', 'if set, skip gas report')
.addFlag({ name: 'skipPrompts', description: 'if set, skip any prompts' })
.addFlag({ name: 'reportGasUsed', description: 'if set, report gas used' })
.addOption({
name: 'saveDeployments',
description: 'if set to false, do not save deployments',
defaultValue: undefined,
type: ArgumentType.STRING_WITHOUT_DEFAULT,
})
.addOption({
name: 'tags',
description: 'specify which tags to deploy, separated by commas',
defaultValue: undefined,
type: ArgumentType.STRING_WITHOUT_DEFAULT,
})
.addOption({
name: 'pollingInterval',
description: 'specify the polling interval used to check transactions',
defaultValue: undefined,
type: ArgumentType.STRING_WITHOUT_DEFAULT,
})
.addOption({
name: 'defaultBuildProfile',
description: 'specify the default profile to use for compilation. Note that the global option "--build-profile" will override it',
defaultValue: 'production',
type: ArgumentType.STRING,
})
.addFlag({
name: 'noCompile',
description: 'if set, skip compilation',
})
.addFlag({
name: 'reset',
description: 'if set, delete deployments first',
})
.setAction(() => import('./tasks/deploy.js'))
.build(),
],
npmPackage: 'hardhat-deploy',
};
export default hardhatPlugin;
export function getHardhatConnection(env) {
if (!env.extra?.connection) {
throw new Error('Hardhat deploy connection not found in the environment');
}
return env.extra.connection;
}
//# sourceMappingURL=index.js.map