Skip to content

Commit

Permalink
move 99_deployScript as hardhat task (#1005)
Browse files Browse the repository at this point in the history
  • Loading branch information
technophile-04 authored Dec 4, 2024
1 parent 95f05f9 commit 311fd08
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
10 changes: 10 additions & 0 deletions packages/hardhat/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import "solidity-coverage";
import "@nomicfoundation/hardhat-verify";
import "hardhat-deploy";
import "hardhat-deploy-ethers";
import { task } from "hardhat/config";
import generateTsAbis from "./scripts/generateTsAbis";

// If not set, it uses the hardhat account 0 private key.
const deployerPrivateKey =
Expand Down Expand Up @@ -173,4 +175,12 @@ const config: HardhatUserConfig = {
},
};

// Extend the deploy task
task("deploy").setAction(async (args, hre, runSuper) => {
// Run the original deploy task
await runSuper(args);
// Force run the generateTsAbis script
await generateTsAbis(hre);
});

export default config;
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function getContractDataFromDeployments() {
const { abi, address, metadata } = JSON.parse(
fs.readFileSync(`${DEPLOYMENTS_DIR}/${chainName}/${contractName}.json`).toString(),
);
const inheritedFunctions = getInheritedFunctions(JSON.parse(metadata).sources, contractName);
const inheritedFunctions = metadata ? getInheritedFunctions(JSON.parse(metadata).sources, contractName) : {};
contracts[contractName] = { address, abi, inheritedFunctions };
}
output[chainId] = contracts;
Expand Down Expand Up @@ -125,9 +125,3 @@ const generateTsAbis: DeployFunction = async function () {
};

export default generateTsAbis;

// Tags are useful if you have multiple deploy files and only want to run one of them.
// e.g. yarn deploy --tags generateTsAbis
generateTsAbis.tags = ["generateTsAbis"];

generateTsAbis.runAtTheEnd = true;

0 comments on commit 311fd08

Please sign in to comment.