🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

hardhat-deploy

Package Overview
Dependencies
Maintainers
1
Versions
227
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hardhat-deploy

Hardhat Plugin For Replicable Deployments And Tests

1.0.3
Source
npm
Version published
Weekly downloads
225K
-26.08%
Maintainers
1
Weekly downloads
 
Created

What is hardhat-deploy?

hardhat-deploy is a plugin for Hardhat that provides a way to manage and script deployments of smart contracts. It offers a structured approach to deploying contracts, managing deployment scripts, and keeping track of deployed contract addresses.

What are hardhat-deploy's main functionalities?

Deploying Contracts

This feature allows you to deploy smart contracts using a structured script. The code sample demonstrates how to deploy a contract named 'MyContract' using the deployer account, with optional constructor arguments and logging enabled.

module.exports = async ({ getNamedAccounts, deployments }) => {
  const { deploy } = deployments;
  const { deployer } = await getNamedAccounts();

  await deploy('MyContract', {
    from: deployer,
    args: [/* constructor arguments */],
    log: true,
  });
};

Managing Deployments

This feature provides the ability to manage and retrieve information about deployed contracts. The code sample shows how to get the deployment details of 'MyContract' and log its address.

const { deployments } = require('hardhat');

async function getDeployment() {
  const myContract = await deployments.get('MyContract');
  console.log('MyContract deployed at:', myContract.address);
}

getDeployment();

Fixture Setup

This feature allows you to set up a fixture for testing, which ensures that the contracts are deployed in a known state. The code sample demonstrates setting up a fixture for 'MyContract' and retrieving its instance.

const { deployments, ethers } = require('hardhat');

async function setupFixture() {
  await deployments.fixture(['MyContract']);
  const myContract = await ethers.getContract('MyContract');
  return { myContract };
}

setupFixture();

Other packages similar to hardhat-deploy

Keywords

ethereum

FAQs

Package last updated on 11 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts