From 244ddc63a80add500556b76841ebe6e5561c5f3f Mon Sep 17 00:00:00 2001 From: Medet Ahmetson Date: Sun, 3 Dec 2023 11:55:35 +0700 Subject: [PATCH] Registrar deployment linted with the SourceNftLib --- ...oy_registrar.ts => 01_deploy_registrar.ts} | 26 ++++++------------- 1 file changed, 8 insertions(+), 18 deletions(-) rename packages/hardhat/deploy/{00_deploy_registrar.ts => 01_deploy_registrar.ts} (60%) diff --git a/packages/hardhat/deploy/00_deploy_registrar.ts b/packages/hardhat/deploy/01_deploy_registrar.ts similarity index 60% rename from packages/hardhat/deploy/00_deploy_registrar.ts rename to packages/hardhat/deploy/01_deploy_registrar.ts index 979448f..d9a6179 100644 --- a/packages/hardhat/deploy/00_deploy_registrar.ts +++ b/packages/hardhat/deploy/01_deploy_registrar.ts @@ -1,13 +1,7 @@ import { HardhatRuntimeEnvironment } from "hardhat/types"; import { DeployFunction } from "hardhat-deploy/types"; import { listSelectors, listRouters, one } from "../scripts/params"; -import * as net from "net"; - -type NetworkParams = { - selector: number | string; - router: string; - registrar: string; -}; +import Deployments from "../scripts/deployments"; /** * Deploys a contract named "Registrar.sol" using the deployer account and @@ -16,20 +10,13 @@ type NetworkParams = { * @param hre HardhatRuntimeEnvironment object. */ const registrarContract: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { - /* - On localhost, the deployer account is the one that comes with Hardhat, which is already funded. - - When deploying to live networks (e.g `yarn deploy --network goerli`), the deployer account - should have sufficient balance to pay for the gas fees for contract creation. - - You can generate a random account with `yarn generate` which will fill DEPLOYER_PRIVATE_KEY - with a random private key in the .env file (then used on hardhat.config.ts) - You can run the `yarn account` command to check your balance in every network. - */ const { deployer } = await hre.getNamedAccounts(); const { deploy } = hre.deployments; - const chainId = parseInt(await hre.getChainId()); + const chainId = await hre.getChainId(); + + const deployments = Deployments[chainId][0]; + const sourceLib: string = deployments.contracts["SourceNftLib"].address; const networkParams = one(chainId); const destSelectors = listSelectors(chainId); @@ -39,6 +26,9 @@ const registrarContract: DeployFunction = async function (hre: HardhatRuntimeEnv // Contract constructor arguments args: [networkParams.selector, networkParams.router, destSelectors, destRouters], log: true, + libraries: { + SourceNftLib: sourceLib, + }, }); };