0.4.2 • Published 1 year ago

hardhat-deploy-ethers v0.4.2

Weekly downloads
3,376
License
MIT
Repository
github
Last release
1 year ago

hardhat

hardhat-deploy-ethers

Hardhat plugin extension for @nomicfoundation/hardhat-ethers and its integration with ethers.js.

The extension add support for hardhat-deploy.

What

Installation

hardhat-deploy-ethers require the installation of hardhat-deploy and @nomicfoundation/hardhat-ethers

Note that you cannot use @nomicfoundation/hardhat-toolbox for installing @nomicfoundation/hardhat-ethers as this interfere with the typing extensions provided by hardhat-deploy-ethers

npm install --save-dev @nomicfoundation/hardhat-ethers ethers hardhat-deploy hardhat-deploy-ethers

Which means you then add the following statement to your hardhat.config.js:

require("@nomicfoundation/hardhat-ethers");
require("hardhat-deploy");
require("hardhat-deploy-ethers");

Or, if you are using TypeScript, add this to your hardhat.config.ts:

import '@nomicfoundation/hardhat-ethers';
import 'hardhat-deploy';
import 'hardhat-deploy-ethers';

Note that if you were using @nomicfoundation/hardhat-toolbox you can simply add the dependencies it added for you with

npm install --save-dev @nomicfoundation/hardhat-chai-matchers @nomicfoundation/hardhat-ethers @typechain/hardhat hardhat-gas-reporter solidity-coverage

and add them to your hardhat.config.js

require('@nomicfoundation/hardhat-chai-matchers');
require('@nomicfoundation/hardhat-ethers');
require('@typechain/hardhat');
require('hardhat-gas-reporter');
require('solidity-coverage');

or hardhat.config.ts (typescript)

import '@nomicfoundation/hardhat-chai-matchers';
import '@nomicfoundation/hardhat-ethers';
import '@typechain/hardhat';
import 'hardhat-gas-reporter';
import 'solidity-coverage';

Tasks

This plugin creates no additional tasks.

Environment extensions

This object has add some extra hardhat-deploy specific functionalities to the hre.ethers added already by @nomicfoundation/hardhat-ethers

Helpers

These helpers are added to the ethers object:

interface HardhatEthersHelpers {
  getContractAtWithSignerAddress: <ContractType extends ethers.BaseContract = ethers.BaseContract>(nameOrAbi: string | any[], address: string, signer: string) => Promise<ContractType>;
  getSignerOrNull: (address: string) => Promise<SignerWithAddress | null>;
  getNamedSigners: () => Promise<Record<string, SignerWithAddress>>;
  getNamedSigner: (name: string) => Promise<SignerWithAddress>;
  getNamedSignerOrNull: (name: string) => Promise<SignerWithAddress | null>;
  getUnnamedSigners: () => Promise<SignerWithAddress[]>;
  getContract: <ContractType extends ethers.BaseContract = ethers.BaseContract>(name: string, signer?: ethers.Signer | string) => Promise<ContractType>;
  getContractOrNull: <ContractType extends ethers.BaseContract = ethers.BaseContract>(name: string, signer?: ethers.Signer | string) => Promise<ContractType | null>;
}

Usage

There are no additional steps you need to take for this plugin to work.

It automatically integrate with the hardhat-deploy plugin if detected and let you do the following:

const contract = await hre.ethers.getContract('<deploymentName>');
@bojinovic/test-package@upshot-tech/upshot-contracts@sonicswap/contracts-devsolidity-examplesgeoracle@infinitebrahmanuniverse/nolb-hard@georacle/contractshumanwalletscw-contracts@bojinovic/filecoin-solidity@everything-registry/sub-chunk-1826wesigvault-mantle-contractswrap-tokens@candyboxdao/contracts-v1baluni-coresoulswap-hardhat-configtisaccountabstractiontisaccountabstraction1tokentea@animoca/ethereum-migrations-core@animoca/ethereum-migrations-core_library@ansdomain/offchain-resolver-contracts@biconomy/account-contracts@biconomy/fallback-gastank-contracts@biconomy-devx/smart-account-contracts@biconomy-devx/wallet-contracts@biconomy/smart-account-contracts@biconomy/wallet-contracts@biconomy-devx/fallback-gastank@biconomy-devx/fallback-gastank-contracts@biconomy-devx/account-contracts@chanceprotocol/yield-source-interface@accountjsxyz/contracts@aaiello/arkive-hardhat@aaiello/hardhat@dao-hub/contracts-v1@connext/vector-contracts@etherspot/archanova-contracts-common@layerzerolabs/solidity-examples@leap-network/yield-source-interface@leverj/chain-deployment@leverj/lever.chain-deployment@lz-asia/stargate@nexeraid/sig-gating-contracts@nexeraid/zkp-gating-contracts@nexeraprotocol/nexera-id-sig-gating-contracts@nexeraprotocol/nexera-id-zkp-gating-contracts@ensdomains/offchain-resolver-contracts@ensdomain/offchain-resolver-contracts@epoch-protocol/accountabstraction@mmasood/yield-source-interface@mattereum/assetpassport-smartcontract@jbx-protocol/contracts@infini3/hardhat-ts@normalfinance/contracts@moraswap/permit2@recruiter.party/contracts@pooltogether/yield-source-interface@reserve-protocol/token-zapper@star2020/vector-contractshumanaccountlayerzero-contractslayerzero-solidity-examples@wallet3/account-abstraction@venusprotocol/governance-contracts@vporton/wrap-tokens@zerodao/common@zerodao/protocol@zerodao/token@sushiswap/hardhat-config@test_art/mock_packageaa-contractsbugscanteadkg-evm-moduledummy-npm-test-2dummy-npm-test-1dummy-npm-test-3dumb-contractsfallback-gastank@skyxexchange/permit2
0.4.2

1 year ago

0.4.1

2 years ago

0.4.0

2 years ago

0.4.0-next.0

2 years ago

0.4.0-next.1

2 years ago

0.3.0-beta.13

3 years ago

0.3.0-beta.12

3 years ago

0.3.0-beta.11

4 years ago

0.3.0-beta.8

4 years ago

0.3.0-beta.9

4 years ago

0.3.0-beta.10

4 years ago

0.3.0-beta.7

5 years ago

0.3.0-beta.6

5 years ago

0.3.0-beta.5

5 years ago

0.3.0-beta.4

5 years ago

0.3.0-beta.3

5 years ago