From bb43ac1da8ce60953fe90c4fde18126b4431942f Mon Sep 17 00:00:00 2001 From: Nenad Date: Mon, 24 Jul 2023 10:28:09 +0200 Subject: [PATCH] Registrar-related script fixes --- contract-address.json | 82 ++++++++++---------- contracts/core/registrar/Registrar.sol | 4 +- contracts/core/registrar/message.sol | 3 +- contracts/core/registrar/scripts/deploy.ts | 30 ++++--- tasks/deploy/deployAngelProtocol.ts | 18 +++-- tasks/deploy/deployRegistrar.ts | 4 +- tasks/helpers/updateRegistrar.ts | 28 ++++--- tasks/manage/accounts/updateConfig.ts | 6 +- test/core/accounts/AccountsStrategy.ts | 6 +- test/core/router/Router.ts | 37 +++------ test/utils/Registrar.ts | 5 +- test/utils/helpers/accounts/defaults.ts | 6 +- utils/manageAddressFile/manageAddressFile.ts | 10 +-- utils/networkHelpers.ts | 5 ++ 14 files changed, 130 insertions(+), 114 deletions(-) diff --git a/contract-address.json b/contract-address.json index 6a1deb73b..2ce196cae 100644 --- a/contract-address.json +++ b/contract-address.json @@ -158,30 +158,30 @@ }, "31337": { "accounts": { - "diamond": "", + "diamond": "0x16fb8e3ab0AF1da9c6e6a589DD025E6558F496Bc", "facets": { - "accountsDeployContract": "", - "accountsDepositWithdrawEndowments": "", - "accountsDonationMatch": "", - "accountsAllowance": "", - "accountsCreateEndowment": "", - "accountsDaoEndowments": "", - "accountsQueryEndowments": "", - "accountsStrategy": "", - "accountsSwapRouter": "", - "accountsUpdate": "", - "accountsUpdateEndowments": "", - "accountsUpdateEndowmentSettingsController": "", - "accountsUpdateStatusEndowments": "", - "diamondCutFacet": "", - "diamondInitFacet": "", - "diamondLoupeFacet": "", - "ownershipFacet": "" + "accountsDeployContract": "0xC4A743126DCcA4DF85B8f75B6eD113bb69dD65A1", + "accountsDepositWithdrawEndowments": "0xA303374bda3A6Ce7550514E6681228Ca12020BBA", + "accountsDonationMatch": "0xB6B18cae509Fcf3542FF6975C2Da06CAAc9773c5", + "accountsAllowance": "0x7F6D5d1bDFB4b281374285510A845cb140d4367b", + "accountsCreateEndowment": "0x455A2aC2F917956c0f2664992C1DDd9Cd6562976", + "accountsDaoEndowments": "0x4060eF0D5a7F0633c5927F7E05041dd7Fcd95f42", + "accountsQueryEndowments": "0xA9526DFDd289b2C2ADa83E07c6dd293AA2C5fEe9", + "accountsStrategy": "0x32Ed2BD67238Be274E127096F42f0a4061aC0Bff", + "accountsSwapRouter": "0x4dcA4bFA0bAa0C8ce741b92B255D967599d994f0", + "accountsUpdate": "0xD7a385546a6a2355C6a1DfAdf33b55c43e2C19B0", + "accountsUpdateEndowments": "0xfAB9d4FA5c03Aa5EaccE715d02E6db648cEE91a3", + "accountsUpdateEndowmentSettingsController": "0x715214AeEf7D4C78b9c329cc4D7375cC08670843", + "accountsUpdateStatusEndowments": "0x15E1268353F6F19D9de2722bD60eC1081b45D3a6", + "diamondCutFacet": "0x8e1f69CfFd8DaD657bF18B91D75BcD26CD6F43AC", + "diamondInitFacet": "0x904df20E7d5A1D577c3763FC7bF35EFa51Df94da", + "diamondLoupeFacet": "0x9cD5998cd48385cb69AE7AaDdFaC83A5DA185FaA", + "ownershipFacet": "0x43dFD957bB91b568176E976A8d4e8ab4E94aeBfD" } }, "axelar": { - "gasService": "", - "gateway": "" + "gasService": "0x2Eb2BBAAF8D16E8BA07BD40D141a7E25C6dD9945", + "gateway": "0x4ee108458a4D97dAa2f8eF90A73942AC7B3a9209" }, "donationMatch": { "emitter": "", @@ -196,8 +196,8 @@ "proxy": "" }, "gasFwd": { - "factory": "", - "implementation": "" + "factory": "0xf342D22125Eddc24c6c3D716E048388D1415C20d", + "implementation": "0x07dEF209701605580893ecd7C3cE2340f5b16875" }, "giftcards": { "implementation": "", @@ -258,8 +258,8 @@ "implementation": "" }, "indexFund": { - "implementation": "", - "proxy": "" + "implementation": "0x59c7E6B2c565Ff92B762523BD6B778CE66dC0302", + "proxy": "0x9A676e781A523b5d0C0e43731313A708CB607508" }, "libraries": { "angelCoreStruct": "", @@ -267,29 +267,29 @@ }, "multiSig": { "charityApplications": { - "implementation": "", - "proxy": "" + "implementation": "0x9687796759CAbecC1674A4Aaf23889fC9EC2FCA2", + "proxy": "0xD63c1597435d2E16d7f216A12A3dA65B3bF12241" }, "apTeam": { - "implementation": "0x712516e61C8B383dF4A63CFe83d7701Bce54B03e", - "proxy": "0xbCF26943C0197d2eE0E5D05c716Be60cc2761508" + "implementation": "0x5C15f56Ee55531f011c6025B205c1750EA469f75", + "proxy": "0xb3e2d928Da7c16d53a8d6DaA14314159fa262754" }, "endowment": { "emitter": { - "implementation": "", - "proxy": "" + "implementation": "0x6b07B7A11cF992B436DE5d3bf28F50eBA606649b", + "proxy": "0x05275a4799cd1B07D81319390fC62Bc7BDbDf269" }, - "factory": "", - "implementation": "" + "factory": "0x086bCD73D03A5e1163A9224Fa09dC5cF70d73094", + "implementation": "0x1F570bf89d86a2C43B9b8d0867267719FC58173D" } }, "registrar": { - "implementation": "0x59F2f1fCfE2474fD5F0b9BA1E73ca90b143Eb8d0", - "proxy": "0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0" + "implementation": "0xADcb9331bfB37dC1b0db12d73c5aFeC3a6c99ce5", + "proxy": "0x959922bE3CAee4b8Cd9a407cc3ac1C251C2007B1" }, "router": { - "implementation": "", - "proxy": "" + "implementation": "0x6039565f9ff755754E9C52B6DFE4aB7bA6dB2957", + "proxy": "0x8896Dce0E60a706244553ADA1aAc5CDCc40a0428" }, "subDao": { "emitter": { @@ -304,13 +304,13 @@ "dai": "", "halo": "", "reserveToken": "", - "seedAsset": "", - "usdc": "", - "wmatic": "" + "seedAsset": "0x1C3f3A797B80315faD4DB7D1a58f3AA934118e03", + "usdc": "0xb8348E945900083A270D9244614d09F9c4937d75", + "wmatic": "0x1D1aEE6D5dC35F3c15E2D11083D0e59C026b64c4" }, "uniswap": { - "factory": "", - "swapRouter": "" + "factory": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8", + "swapRouter": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" } }, "80001": { diff --git a/contracts/core/registrar/Registrar.sol b/contracts/core/registrar/Registrar.sol index c35e4fa11..6c0b13421 100644 --- a/contracts/core/registrar/Registrar.sol +++ b/contracts/core/registrar/Registrar.sol @@ -63,13 +63,13 @@ contract Registrar is LocalRegistrar, Storage, ReentrancyGuard { emit ConfigUpdated(); LocalRegistrarLib.LocalRegistrarStorage storage lrs = LocalRegistrarLib.localRegistrarStorage(); - lrs.NetworkConnections["Polygon"] = IAccountsStrategy.NetworkInfo({ + lrs.NetworkConnections[details.networkName] = IAccountsStrategy.NetworkInfo({ chainId: block.chainid, router: details.router, axelarGateway: details.axelarGateway, ibcChannel: "", transferChannel: "", - gasReceiver: details.axelarGasRecv, + gasReceiver: details.axelarGasService, gasLimit: 0 }); emit NetworkConnectionPosted(block.chainid); diff --git a/contracts/core/registrar/message.sol b/contracts/core/registrar/message.sol index 315cc50ac..9338aa08b 100644 --- a/contracts/core/registrar/message.sol +++ b/contracts/core/registrar/message.sol @@ -10,7 +10,8 @@ library RegistrarMessages { LibAccounts.SplitDetails splitToLiquid; address router; address axelarGateway; - address axelarGasRecv; + address axelarGasService; + string networkName; } struct UpdateConfigRequest { diff --git a/contracts/core/registrar/scripts/deploy.ts b/contracts/core/registrar/scripts/deploy.ts index 6451e9cb6..1457fdbd7 100644 --- a/contracts/core/registrar/scripts/deploy.ts +++ b/contracts/core/registrar/scripts/deploy.ts @@ -1,8 +1,16 @@ import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; import config from "config"; import {HardhatRuntimeEnvironment} from "hardhat/types"; -import {ProxyContract__factory, Registrar__factory, LocalRegistrar__factory} from "typechain-types"; -import {Deployment, getContractName, logger, updateAddresses, validateAddress} from "utils"; +import {LocalRegistrar__factory, ProxyContract__factory, Registrar__factory} from "typechain-types"; +import { + Deployment, + getChainId, + getContractName, + getNetworkNameFromChainId, + logger, + updateAddresses, + validateAddress, +} from "utils"; type RegistrarDeployData = { axelarGateway: string; @@ -11,7 +19,7 @@ type RegistrarDeployData = { owner?: string; deployer: SignerWithAddress; proxyAdmin: SignerWithAddress; - treasuryAddress: string; + treasury: string; }; export async function deployRegistrar( @@ -22,13 +30,16 @@ export async function deployRegistrar( owner = "", deployer, proxyAdmin, - treasuryAddress, + treasury, }: RegistrarDeployData, hre: HardhatRuntimeEnvironment ): Promise { logger.out("Deploying Registrar..."); try { + const chainId = await getChainId(hre); + const networkName = getNetworkNameFromChainId(chainId); + validateAddress(axelarGateway, "axelarGateway"); validateAddress(axelarGasService, "axelarGasService"); validateAddress(owner, "owner"); @@ -44,14 +55,15 @@ export async function deployRegistrar( // deploy proxy logger.out("Deploying proxy..."); const initData = registrar.interface.encodeFunctionData( - "initialize((address,(uint256,uint256,uint256),address,address,address))", + "initialize((address,(uint256,uint256,uint256),address,address,address,string))", [ { - treasury: treasuryAddress, + treasury, splitToLiquid: config.REGISTRAR_DATA.splitToLiquid, - router: router, - axelarGateway: axelarGateway, - axelarGasRecv: axelarGasService, + router, + axelarGateway, + axelarGasService, + networkName, }, ] ); diff --git a/tasks/deploy/deployAngelProtocol.ts b/tasks/deploy/deployAngelProtocol.ts index 179e52c65..5e9ebda59 100644 --- a/tasks/deploy/deployAngelProtocol.ts +++ b/tasks/deploy/deployAngelProtocol.ts @@ -1,7 +1,15 @@ -import {task} from "hardhat/config"; -import {Deployment, confirmAction, isLocalNetwork, logger, verify} from "utils"; import config from "config"; -import {ADDRESS_ZERO, getSigners, resetAddresses} from "utils"; +import {task} from "hardhat/config"; +import { + ADDRESS_ZERO, + Deployment, + confirmAction, + getSigners, + isLocalNetwork, + logger, + resetAddresses, + verify, +} from "utils"; import {deployAccountsDiamond} from "contracts/core/accounts/scripts/deploy"; import {deployIndexFund} from "contracts/core/index-fund/scripts/deploy"; @@ -12,12 +20,12 @@ import {deployEndowmentMultiSig} from "contracts/normalized_endowment/endowment- // import {deployEmitters} from "contracts/normalized_endowment/scripts/deployEmitter"; // import {deployImplementation} from "contracts/normalized_endowment/scripts/deployImplementation"; +import {deployGasFwd} from "contracts/core/gasFwd/scripts/deploy"; import { getOrDeployThirdPartyContracts, updateRegistrarConfig, updateRegistrarNetworkConnections, } from "../helpers"; -import {deployGasFwd} from "contracts/core/gasFwd/scripts/deploy"; task("deploy:AngelProtocol", "Will deploy complete Angel Protocol") .addFlag("skipVerify", "Skip contract verification") @@ -50,7 +58,7 @@ task("deploy:AngelProtocol", "Will deploy complete Angel Protocol") owner: apTeamMultisig?.address, deployer, proxyAdmin, - treasuryAddress: treasury.address, + treasury: treasury.address, }, hre ); diff --git a/tasks/deploy/deployRegistrar.ts b/tasks/deploy/deployRegistrar.ts index 47e9fac0e..31a451442 100644 --- a/tasks/deploy/deployRegistrar.ts +++ b/tasks/deploy/deployRegistrar.ts @@ -48,7 +48,7 @@ task( owner: apTeamMultiSig, deployer, proxyAdmin, - treasuryAddress: treasury.address, + treasury: treasury.address, }, hre ); @@ -99,7 +99,7 @@ task( } await hre.run("manage:accounts:updateConfig", { - newRegistrar: registrarDeployment.address, + registrarContract: registrarDeployment.address, yes: true, }); await hre.run("manage:IndexFund:updateRegistrar", { diff --git a/tasks/helpers/updateRegistrar.ts b/tasks/helpers/updateRegistrar.ts index ce5493e75..e3eb600c4 100644 --- a/tasks/helpers/updateRegistrar.ts +++ b/tasks/helpers/updateRegistrar.ts @@ -1,44 +1,52 @@ -import { BigNumber } from "ethers"; import {HardhatRuntimeEnvironment} from "hardhat/types"; import {APTeamMultiSig__factory, Registrar__factory} from "typechain-types"; import { IAccountsStrategy, RegistrarMessages, } from "typechain-types/contracts/core/registrar/interfaces/IRegistrar"; -import {NetworkConnectionAction, getNetworkNameFromChainId, getSigners, logger, structToObject, validateAddress} from "utils"; +import { + NetworkConnectionAction, + getChainId, + getNetworkNameFromChainId, + getSigners, + logger, + structToObject, + validateAddress, +} from "utils"; export async function updateRegistrarNetworkConnections( registrar = "", apTeamMultisig = "", - newNetworkInfo: Partial, + networkInfo: Partial, hre: HardhatRuntimeEnvironment ) { logger.divider(); - logger.out(`Updating Registrar network info for chain id: ${newNetworkInfo.chainId}`); try { + const chainId = await getChainId(hre); + const networkName = getNetworkNameFromChainId(chainId); + + logger.out(`Updating Registrar network info for chain: ${networkName}`); + validateAddress(registrar, "registrar"); validateAddress(apTeamMultisig, "apTeamMultisig"); - const network = await hre.ethers.provider.getNetwork(); - const networkName = getNetworkNameFromChainId(network.chainId) - const {apTeamMultisigOwners} = await getSigners(hre); const registrarContract = Registrar__factory.connect(registrar, apTeamMultisigOwners[0]); logger.out("Fetching current Registrar's network connection data..."); - + const struct = await registrarContract.queryNetworkConnection(networkName); const curNetworkConnection = structToObject(struct); logger.out(curNetworkConnection); logger.out("Network info to update:"); - logger.out(newNetworkInfo); + logger.out(networkInfo); const updateNetworkConnectionsData = registrarContract.interface.encodeFunctionData( "updateNetworkConnections", - [networkName, {...curNetworkConnection, ...newNetworkInfo}, NetworkConnectionAction.POST] + [networkName, {...curNetworkConnection, ...networkInfo}, NetworkConnectionAction.POST] ); const apTeamMultisigContract = APTeamMultiSig__factory.connect( apTeamMultisig, diff --git a/tasks/manage/accounts/updateConfig.ts b/tasks/manage/accounts/updateConfig.ts index feaf71437..7c7908f5b 100644 --- a/tasks/manage/accounts/updateConfig.ts +++ b/tasks/manage/accounts/updateConfig.ts @@ -10,7 +10,7 @@ type TaskArgs = { earlyLockedWithdrawFeeBps?: number; earlyLockedWithdrawFeePayoutAddress?: string; maxGeneralCategoryId?: number; - newRegistrar?: string; + registrarContract?: string; yes: boolean; }; @@ -27,7 +27,7 @@ task("manage:accounts:updateConfig", "Will update Accounts Diamond config") ) .addOptionalParam("maxGeneralCategoryId", "The max general category id.", undefined, types.int) .addOptionalParam( - "newRegistrar", + "registrarContract", "Registrar contract address. Will do a local lookup from contract-address.json if none is provided." ) .addFlag("yes", "Automatic yes to prompt.") @@ -63,7 +63,7 @@ task("manage:accounts:updateConfig", "Will update Accounts Diamond config") apTeamMultisigOwners[0] ); const data = accountsUpdate.interface.encodeFunctionData("updateConfig", [ - newConfig.newRegistrar || curConfig.registrarContract, + newConfig.registrarContract || curConfig.registrarContract, newConfig.maxGeneralCategoryId || curConfig.maxGeneralCategoryId, { bps: newConfig.earlyLockedWithdrawFeeBps || curConfig.earlyLockedWithdrawFee.bps, diff --git a/test/core/accounts/AccountsStrategy.ts b/test/core/accounts/AccountsStrategy.ts index 5a8039d3a..33308c95b 100644 --- a/test/core/accounts/AccountsStrategy.ts +++ b/test/core/accounts/AccountsStrategy.ts @@ -17,7 +17,6 @@ import { DEFAULT_SETTINGS_STRUCT, DEFAULT_STRATEGY_PARAMS, DEFAULT_STRATEGY_SELECTOR, - NetworkInfoStruct, StrategyApprovalState, VaultActionStatus, VaultActionStructToArray, @@ -41,6 +40,7 @@ import { Router__factory, TestFacetProxyContract, } from "typechain-types"; +import {IAccountsStrategy} from "typechain-types/contracts/core/registrar/Registrar"; import {AccountStorage} from "typechain-types/contracts/test/accounts/TestFacetProxyContract"; import {getSigners} from "utils"; import {deployFacetAsProxy} from "./utils"; @@ -77,7 +77,7 @@ describe("AccountsStrategy", function () { let state: TestFacetProxyContract; let token: DummyERC20; let gateway: DummyGateway; - let network: NetworkInfoStruct; + let network: IAccountsStrategy.NetworkInfoStruct; const ACCOUNT_ID = 1; before(async function () { @@ -461,7 +461,7 @@ describe("AccountsStrategy", function () { let state: TestFacetProxyContract; let token: DummyERC20; let gateway: DummyGateway; - let network: NetworkInfoStruct; + let network: IAccountsStrategy.NetworkInfoStruct; const ACCOUNT_ID = 1; before(async function () { diff --git a/test/core/router/Router.ts b/test/core/router/Router.ts index 4ac176e3c..f8fe0807d 100644 --- a/test/core/router/Router.ts +++ b/test/core/router/Router.ts @@ -1,44 +1,35 @@ +import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; import {expect} from "chai"; import hre from "hardhat"; -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; -import { - DummyERC20, - DummyGasService, - DummyGateway, - DummyVault, - IRouter, - LocalRegistrar, - LocalRegistrar__factory, - ITransparentUpgradeableProxy__factory, - Router, - Router__factory, - Registrar__factory, - Registrar, -} from "typechain-types"; import { - ArrayToVaultActionStruct, IVaultHelpers, StrategyApprovalState, - VaultActionStructToArray, deployDummyERC20, deployDummyGasService, deployDummyGateway, deployDummyVault, deployRegistrarAsProxy, packActionData, - unpackActionData, } from "test/utils"; +import { + DummyERC20, + DummyGasService, + DummyGateway, + DummyVault, + ITransparentUpgradeableProxy__factory, + Registrar, + Router, + Router__factory, +} from "typechain-types"; import {getSigners} from "utils"; import {LocalRegistrarLib} from "../../../typechain-types/contracts/core/registrar/LocalRegistrar"; describe("Router", function () { - const {ethers, upgrades} = hre; + const {ethers} = hre; let owner: SignerWithAddress; let admin: SignerWithAddress; let user: SignerWithAddress; let collector: SignerWithAddress; - let Router: Router__factory; - let Registrar: Registrar__factory; let defaultApParams = { routerAddr: ethers.constants.AddressZero, refundAddr: ethers.constants.AddressZero, @@ -109,10 +100,6 @@ describe("Router", function () { expect(await upgradeProxy(admin, router.address)); }); - it("Should set the right owner", async function () { - expect(await router.owner()).to.equal(owner.address); - }); - it("Accepts and initializes the gateway and gas receiver as part of init", async function () { const gateway = "0x4F4495243837681061C4743b74B3eEdf548D56A5"; const gasRecv = "0x2d5d7d31F671F86C782533cc367F14109a082712"; diff --git a/test/utils/Registrar.ts b/test/utils/Registrar.ts index 495d05f7a..be819f908 100644 --- a/test/utils/Registrar.ts +++ b/test/utils/Registrar.ts @@ -30,14 +30,15 @@ export async function deployRegistrarAsProxy( const registrarImpl = await Registrar.deploy(); await registrarImpl.deployed(); const data = registrarImpl.interface.encodeFunctionData( - "initialize((address,(uint256,uint256,uint256),address,address,address))", + "initialize((address,(uint256,uint256,uint256),address,address,address,string))", [ { treasury: ethers.constants.AddressZero, splitToLiquid: DEFAULT_SPLIT_STRUCT, router: ethers.constants.AddressZero, axelarGateway: ethers.constants.AddressZero, - axelarGasRecv: ethers.constants.AddressZero, + axelarGasService: ethers.constants.AddressZero, + networkName: "localhost", }, ] ); diff --git a/test/utils/helpers/accounts/defaults.ts b/test/utils/helpers/accounts/defaults.ts index 99317e00b..074bce300 100644 --- a/test/utils/helpers/accounts/defaults.ts +++ b/test/utils/helpers/accounts/defaults.ts @@ -2,11 +2,11 @@ import {ethers} from "hardhat"; import {AccountStorage} from "typechain-types/contracts/test/accounts/TestFacetProxyContract"; import {AccountMessages} from "typechain-types/contracts/core/accounts/facets/AccountsStrategy"; import {LibAccounts} from "typechain-types/contracts/multisigs/CharityApplications"; -import {NetworkInfoStruct} from "../types"; import {RegistrarStorage} from "typechain-types/contracts/core/registrar/Registrar"; import {BigNumber} from "ethers"; -import {DEFAULT_STRATEGY_SELECTOR, StrategyApprovalState} from "test/utils"; +import {DEFAULT_STRATEGY_SELECTOR} from "test/utils"; import {LocalRegistrarLib} from "typechain-types/contracts/core/registrar/LocalRegistrar"; +import {IAccountsStrategy} from "typechain-types/contracts/core/registrar/interfaces/IRegistrar"; export const DEFAULT_PERMISSIONS_STRUCT: LibAccounts.SettingsPermissionStruct = { locked: false, @@ -97,7 +97,7 @@ export const DEFAULT_ACCOUNTS_CONFIG: AccountStorage.ConfigStruct = { earlyLockedWithdrawFee: DEFAULT_FEE_STRUCT, }; -export const DEFAULT_NETWORK_INFO: NetworkInfoStruct = { +export const DEFAULT_NETWORK_INFO: IAccountsStrategy.NetworkInfoStruct = { chainId: 0, router: ethers.constants.AddressZero, axelarGateway: ethers.constants.AddressZero, diff --git a/utils/manageAddressFile/manageAddressFile.ts b/utils/manageAddressFile/manageAddressFile.ts index 6eb3d7f10..ae9bc6e54 100644 --- a/utils/manageAddressFile/manageAddressFile.ts +++ b/utils/manageAddressFile/manageAddressFile.ts @@ -1,9 +1,8 @@ import {HardhatRuntimeEnvironment} from "hardhat/types"; - -import {DEFAULT_CONTRACT_ADDRESS_FILE_PATH, isLocalNetwork} from ".."; +import {DeepPartial} from "types"; +import {DEFAULT_CONTRACT_ADDRESS_FILE_PATH, getChainId, isLocalNetwork} from ".."; import {createEmptyAddressObj, getAddressesByNetworkId, saveFrontendFiles} from "./helpers"; import {AddressObj} from "./types"; -import {DeepPartial} from "types"; /** * Removes contract address for the current network from the appropriate file. @@ -66,8 +65,3 @@ function updateInternal(original: T, partial: DeepPartial): T { return updated; } - -async function getChainId(hre: HardhatRuntimeEnvironment): Promise { - const chainId = (await hre.ethers.provider.getNetwork()).chainId; - return chainId; -} diff --git a/utils/networkHelpers.ts b/utils/networkHelpers.ts index 60c89c9bc..35fc62519 100644 --- a/utils/networkHelpers.ts +++ b/utils/networkHelpers.ts @@ -17,6 +17,11 @@ export function getNetworkNameFromChainId(id: number): string { return AxelarNetworks.get(id); } +export async function getChainId(hre: HardhatRuntimeEnvironment): Promise { + const chainId = (await hre.ethers.provider.getNetwork()).chainId; + return chainId; +} + // There are errors/mismatches in the axelar sdk jsons, so we just implement a lightweight // version here and use this instead. const AxelarNetworks = new TwoWayMap({