From 4e161cb86d8cf6d7499557d6b975a873868f50c6 Mon Sep 17 00:00:00 2001 From: Medet Ahmetson Date: Sun, 3 Dec 2023 11:55:52 +0700 Subject: [PATCH] Deploy LinkedFactory --- packages/hardhat/deploy/02_deploy_factory.ts | 31 ++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 packages/hardhat/deploy/02_deploy_factory.ts diff --git a/packages/hardhat/deploy/02_deploy_factory.ts b/packages/hardhat/deploy/02_deploy_factory.ts new file mode 100644 index 0000000..b13555b --- /dev/null +++ b/packages/hardhat/deploy/02_deploy_factory.ts @@ -0,0 +1,31 @@ +import { HardhatRuntimeEnvironment } from "hardhat/types"; +import { DeployFunction } from "hardhat-deploy/types"; +import { one, listSelectors, listRouters } from "../scripts/params"; + +/** + * Deploys a contract named "Registrar.sol" using the deployer account and + * constructor arguments set to the deployer address + * + * @param hre HardhatRuntimeEnvironment object. + */ +const registrarContract: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { + const { deployer } = await hre.getNamedAccounts(); + const { deploy } = hre.deployments; + + const chainId = parseInt(await hre.getChainId()); + const networkParams = one(chainId); + const destSelectors = listSelectors(chainId); + const destRouters = listRouters(chainId); + await deploy("LinkedFactory", { + from: deployer, + // Contract constructor arguments + args: [networkParams.selector, networkParams.router, destSelectors, destRouters], + log: true, + }); +}; + +export default registrarContract; + +// Tags are useful if you have multiple deploy files and only want to run one of them. +// e.g. yarn deploy --tags Registrar.sol +registrarContract.tags = ["Factory"];