Dynamically generate deployable Hardhat contract artifacts.
npm install --save-dev hardhat-artifactor
# or
yarn add --dev hardhat-artifactor
Load plugin in Hardhat config:
require('hardhat-artifactor');
Call the createArtifactFromTemplate
function available in the Hardhat Runtime Environment to create an artifact with an ABI matching an existing artifact but with custom bytecode:
await createArtifactFromTemplate(
'TemplateContract',
'GeneratedContract',
bytecode,
);
Call the overwriteArtifact
function available in the Hardhat Runtime Environment to replace the bytecode of an existing artifact with custom bytecode:
await overwriteArtifact('Contract', bytecode);
Install dependencies via Yarn:
yarn install
Setup Husky to format code on commit:
yarn prepare