wighawag/rocketh/hardhat-deploy-migration

Claude Code and agent skill by wighawag/rocketh

Trust tier 2
  • community
  • ext:[{"type":"config","description":"Configuration overrides"}]
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Comprehensive guide for migrating projects from hardhat-deploy v1 to v2, including dependency updates, configuration restructuring, deploy script conversion, test updates, and troubleshooting

Install

npx vskill@latest install wighawag/rocketh/hardhat-deploy-migration

Semi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard

SKILL.md

The same SKILL.md was published earlier as wighawag/rocketh/hardhat-deploy-migration.

SKILL: Migrate hardhat-deploy v1 to v2

This guide provides comprehensive instructions for migrating projects from hardhat-deploy v1 to v2. It's designed for AI assistants to understand and execute the migration process systematically.

Note: For complete working examples, see the template-ethereum-contracts repository which demonstrates a full hardhat-deploy v2 setup.
Before converting anything, check the project against the capability map. This skill teaches how to translate what v2 HAS. What v1 has that v2 does not, or has differently (every deployments member, every deploy and proxy option, named-account forms, CLI flags, environment variables, deployment-file fields, catchUnknownSigner's thunk form, and how one project consumes another's contracts), is listed in ONE place: the v1-to-v2 capability map (source: `hardhat-deploy/migration/index.md`). Fetch it, look up every v1 feature the project uses, and when one is marked not supported or not supported yet, tell the user before porting that script. Do not invent a translation the map does not give.

Table of Contents

  1. Introduction
  2. Prerequisites Check
  3. Architecture Comparison
  4. Step-by-Step Migration
  5. Common Patterns & Examples
  6. Troubleshooting Guide
  7. Migration Checklist
  8. Advanced Topics

Introduction

Overview

hardhat-deploy v2 is a complete rewrite that requires Hardhat 3.x and introduces significant architectural changes:

  • ESM Modules: v2 uses native ES modules (import/export) instead of CommonJS
  • Rocketh Integration: v2 integrates with the rocketh ecosystem for deployment management
  • Configuration Changes: Named accounts moved from hardhat.config.ts to rocketh/config.ts
  • Plugin System: Enhanced extensibility through rocketh extensions
Key Differences Summary
Aspectv1 Patternv2 Pattern
Hardhat version2.x3.x (specifically ^3.1.5)
Module systemCommonJS (require/module.exports)ESM (import/export)
Named accountsnamedAccounts in hardhat.config.tsrocketh/config.ts
Deploy functiondeployments.deploy(name, {...})deploy(name, {account: ..., artifact: ...})
Deployer paramfrom: addressaccount: address
Solidity configsolidity: "0.8.x"solidity: {profiles: {default: {version: "..."}}}
Test fixturesdeployments.createFixture()Custom fixture with loadAndExecuteDeploymentsFromFiles()
Contract interactionethers.getContract()env.get() + env.execute()
When to Stay on v1

If you have a production project using hardhat-deploy v1 with Hardhat 2.x, it's often better to stay on v1:

bash
npm uninstall hardhat-deploy
npm install hardhat-deploy@1

v1 continues to receive security fixes but won't get new features.


Prerequisites Check

Before starting the migration, verify your environment meets these requirements:

Checklist
bash
# Check Node.js version (requires 22+ for v2)
node --version
# Check Hardhat version (requires 3.x+ for v2)
npx hardhat --version
# Check if project is using CommonJS or ESM
grep -q '"type": "module"' package.json && echo "ESM" || echo "CommonJS"
Required Versions
  • Node.js: 22 or higher
  • Hardhat: 3.x or higher (specifically ^3.1.5 recommended)
  • TypeScript: 5.x (for TypeScript projects)
Pre-Migration Assessment

Check for these v1 patterns in your project:

typescript
// In hardhat.config.ts
- namedAccounts configuration
- require() statements
- module.exports
- solidity: "0.8.x" format
// In deploy scripts
- async function (hre) { ... }
- hre.deployments.deploy()
- hre.getNamedAccounts()
- from: parameter
- log: true parameter
// In tests
- deployments.createFixture()
- ethers.getContract()
- getUnnamedAccounts()

Architecture Comparison

v1 Architecture
mermaid
graph TD
A[hardhat.config.ts] -->|contains| B[namedAccounts]
A -->|contains| C[solidity config]
A -->|requires| D[hardhat-deploy]
E[deploy/*.ts] -->|imports| F[HardhatRuntimeEnvironment]
F -->|provides| G[getNamedAccounts]
F -->|provides| H[deployments]
I[test/*.ts] -->|uses| J[deployments.createFixture]
J -->|calls| K[deployments.fixture]
K -->|gets| L[ethers.getContract]

Key Files in v1:

  • hardhat.config.ts - Single configuration file
  • deploy/*.ts - Deploy scripts with HRE pattern
  • test/*.ts - Tests using deployments fixture
  • utils/network.ts - Network configuration helper
v2 Architecture
mermaid
graph TD
A[hardhat.config.ts] -->|imports plugins| B[HardhatDeploy]
A -->|uses helpers| C[addNetworksFromEnv]
A -->|contains| D[solidity profiles]
E[rocketh/config.ts] -->|contains| F[accounts config]
E -->|contains| G[extensions]
H[rocketh/deploy.ts] -->|exports| I[deployScript]
H -->|exports| J[artifacts]
K[rocketh/environment.ts] -->|exports| L[loadEnvironmentFromHardhat]
K -->|exports| M[loadAndExecuteDeploymentsFromFiles]
N[deploy/*.ts] -->|imports| I
N -->|uses| J
O[test/*.ts] -->|imports| M
O -->|uses| env.get and env.execute

Key Files in v2:

  • hardhat.config.ts - Hardhat configuration (no named accounts)
  • rocketh/config.ts - Named accounts and extensions
  • rocketh/deploy.ts - Deploy script setup
  • rocketh/environment.ts - Environment setup for tests/scripts
  • deploy/*.ts - Deploy scripts with new pattern
  • test/*.ts - Tests using new fixture pattern

Step-by-Step Migration

Step 1: Update Dependencies

Update your package.json to use Hardhat 3.x and hardhat-deploy v2:

v1 package.json example:

json
{
"devDependencies": {
"hardhat": "^2.22.18",
"hardhat-deploy": "^0.14.0",
"hardhat-deploy-ethers": "^0.4.2",
"hardhat-deploy-tenderly": "^1.0.0",
"ethers": "^6.13.5",
"hardhat-deploy": "^0.14.0"
}
}

v2 package.json example: (see template-ethereum-contracts/package.json)

json
{
"type": "module",
"devDependencies": {
"hardhat": "^3.1.4",
"hardhat-deploy": "^2.0.0",
"rocketh": "^0.17.15",
"@rocketh/deploy": "^0.17.9",
"@rocketh/read-execute": "^0.17.9",
"@rocketh/node": "^0.17.18",
"@rocketh/proxy": "^0.17.13",
"@rocketh/signer": "^0.17.9",
"viem": "^2.45.0",
"earl": "^2.0.0",
"@nomicfoundation/hardhat-viem": "^3.0.1",
"@nomicfoundation/hardhat-node-test-runner": "^3.0.8",
"@nomicfoundation/hardhat-network-helpers": "^3.0.3",
"@nomicfoundation/hardhat-keystore": "^3.0.3"
}
}

Transformation Rules:

  1. Add "type": "module" at the top level
  2. Update hardhat to ^3.1.4 or higher
  3. Update hardhat-deploy to ^2.0.0 or higher
  4. Remove hardhat-deploy-ethers and hardhat-deploy-tenderly
  5. Add rocketh packages: rocketh, @rocketh/deploy, @rocketh/read-execute, @rocketh/node, @rocketh/signer
  6. Add optional packages: @rocketh/proxy, @rocketh/export, @rocketh/verifier, @rocketh/doc
  7. Add viem for contract interactions
  8. Add earl for assertions (for node:test)
  9. Add Hardhat 3.x plugins

Install dependencies:

bash
pnpm install
Step 2: Restructure Configuration
2.1 Convert hardhat.config.ts

v1 hardhat.config.ts example:

typescript
import 'dotenv/config';
import {HardhatUserConfig} from 'hardhat/types';
import '@nomicfoundation/hardhat-chai-matchers';
import '@nomicfoundation/hardhat-ethers';
import '@typechain/hardhat';
import 'hardhat-deploy';
import 'hardhat-deploy-ethers';
import 'hardhat-deploy-tenderly';
import {node_url, accounts, addForkConfiguration} from './utils/network';
const config: HardhatUserConfig = {
solidity: {
compilers: [
{
version: '0.8.17',
settings: {
optimizer: {
enabled: true,
runs: 2000,
},
},
},
],
},
namedAccounts: {
deployer: 0,
simpleERC20Beneficiary: 1,
},
networks: addForkConfiguration({
hardhat: {
initialBaseFeePerGas: 0,
},
localhost: {
url: node_url('localhost'),
accounts: accounts(),
},
mainnet: {
url: node_url('mainnet'),
accounts: accounts('mainnet'),
},
sepolia: {
url: node_url('sepolia'),
accounts: accounts('sepolia'),
},
}),
paths: {
sources: 'src',
},
mocha: {
timeout: 0,
},
external: process.env.HARDHAT_FORK
? {
deployments: {
hardhat: ['deployments/' + process.env.HARDHAT_FORK],
localhost: ['deployments/' + process.env.HARDHAT_FORK],
},
}
: undefined,
};
export default config;

v2 hardhat.config.ts example: (see template-ethereum-contracts/hardhat.config.ts)

typescript
import type {HardhatUserConfig} from 'hardhat/config';
import HardhatNodeTestRunner from '@nomicfoundation/hardhat-node-test-runner';
import HardhatViem from '@nomicfoundation/hardhat-viem';
import HardhatNetworkHelpers from '@nomicfoundation/hardhat-network-helpers';
import HardhatKeystore from '@nomicfoundation/hardhat-keystore';
import HardhatDeploy from 'hardhat-deploy';
import {addForkConfiguration, addNetworksFromEnv, addNetworksFromKnownList} from 'hardhat-deploy/helpers';
const config: HardhatUserConfig = {
plugins: [HardhatNodeTestRunner, HardhatViem, HardhatNetworkHelpers, HardhatKeystore, HardhatDeploy],
solidity: {
profiles: {
default: {
version: '0.8.17',
},
production: {
version: '0.8.17',
settings: {
optimizer: {
enabled: true,
runs: 999999,
},
},
},
},
},
networks:
// This add the fork configuration for chosen network
addForkConfiguration(
// this add a network config for all known chain using kebab-cases names
// Note that MNEMONIC_<network> (or MNEMONIC if the other is not set) will
// be used for account
// Similarly ETH_NODE_URI_<network> will be used for rpcUrl
// Note that if you set these env variable to have the value: "SECRET" it will be like using:
// configVariable('SECRET_ETH_NODE_URI_<network>')
// configVariable('SECRET_MNEMONIC_<network>')
addNetworksFromKnownList(
// this add network for each respective env var found (ETH_NODE_URI_<network>)
// it will also read MNEMONIC_<network> to populate the accounts
// And like above it will use configVariable if set to SECRET
addNetworksFromEnv(
// and you can add in your specific network here
{
default: {
type: 'edr-simulated',
chainType: 'l1',
accounts: {
mnemonic: process.env.MNEMONIC || undefined,
},
},
},
),
),
),
paths: {
sources: ['src'],
},
generateTypedArtifacts: {
destinations: [
{
folder: './generated',
mode: 'typescript',
},
],
},
};
export default config;

Transformation Rules:

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
35
Repository forks
10
7-day trend score
18

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Extension points

  • configConfiguration overrides

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/wighawag/rocketh/hardhat-deploy-migration/badge)](https://verified-skill.com/skills/wighawag/rocketh/hardhat-deploy-migration)

Something wrong with this skill or its page? Tell us.