diff --git a/contracts/core/accounts/diamond/upgradeInitializers/DiamondInit.sol b/contracts/core/accounts/diamond/upgradeInitializers/DiamondInit.sol index ec150ae7e..f41155fe5 100644 --- a/contracts/core/accounts/diamond/upgradeInitializers/DiamondInit.sol +++ b/contracts/core/accounts/diamond/upgradeInitializers/DiamondInit.sol @@ -25,7 +25,7 @@ import {AccountStorage} from "./../../storage.sol"; contract DiamondInit { // You can add parameters to this function in order to pass in // data to set your own state variables - function init(address owner, address registrar) external { + function init(address owner, address registrar, string memory networkName) external { // adding ERC165 data LibDiamond.DiamondStorage storage ds = LibDiamond.diamondStorage(); ds.supportedInterfaces[type(IERC165).interfaceId] = true; @@ -39,7 +39,7 @@ contract DiamondInit { state.config.owner = owner; state.config.registrarContract = registrar; - state.config.networkName = "Polygon"; + state.config.networkName = networkName; state.config.nextAccountId = 1; // add your own state variables diff --git a/contracts/core/accounts/scripts/deploy/cutDiamond.ts b/contracts/core/accounts/scripts/deploy/cutDiamond.ts index 1d3473180..9d55a4267 100644 --- a/contracts/core/accounts/scripts/deploy/cutDiamond.ts +++ b/contracts/core/accounts/scripts/deploy/cutDiamond.ts @@ -1,8 +1,7 @@ import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; import {HardhatRuntimeEnvironment} from "hardhat/types"; import {DiamondCutFacet__factory, DiamondInit} from "typechain-types"; -import {logger} from "utils"; - +import {getAxlNetworkName, logger} from "utils"; import {FacetCut} from "./types"; export default async function cutDiamond( @@ -16,8 +15,13 @@ export default async function cutDiamond( ) { logger.out("Cutting the Diamond with new facets..."); + const networkName = await getAxlNetworkName(hre); const diamondCut = DiamondCutFacet__factory.connect(address, admin); - const calldata = diamondInit.interface.encodeFunctionData("init", [owner, registrar]); + const calldata = diamondInit.interface.encodeFunctionData("init", [ + owner, + registrar, + networkName, + ]); const cuts = facetCuts.map((x) => x.cut); const tx = await diamondCut.diamondCut(cuts, diamondInit.address, calldata); diff --git a/contracts/core/registrar/scripts/deploy.ts b/contracts/core/registrar/scripts/deploy.ts index 1457fdbd7..1a886e367 100644 --- a/contracts/core/registrar/scripts/deploy.ts +++ b/contracts/core/registrar/scripts/deploy.ts @@ -6,7 +6,7 @@ import { Deployment, getChainId, getContractName, - getNetworkNameFromChainId, + getAxlNetworkName, logger, updateAddresses, validateAddress, @@ -37,8 +37,7 @@ export async function deployRegistrar( logger.out("Deploying Registrar..."); try { - const chainId = await getChainId(hre); - const networkName = getNetworkNameFromChainId(chainId); + const networkName = await getAxlNetworkName(hre); validateAddress(axelarGateway, "axelarGateway"); validateAddress(axelarGasService, "axelarGasService"); diff --git a/contracts/multisigs/CharityApplications.sol b/contracts/multisigs/CharityApplications.sol index 3619d0161..3655eebc3 100644 --- a/contracts/multisigs/CharityApplications.sol +++ b/contracts/multisigs/CharityApplications.sol @@ -36,7 +36,7 @@ contract CharityApplications is MultiSigGeneric, StorageApplications, ICharityAp modifier proposalConfirmed(uint256 proposalId, address _owner) { require( proposalConfirmations[proposalId].confirmationsByOwner[_owner], - "Proposal is confirmed" + "Proposal is not confirmed" ); _; } @@ -44,7 +44,7 @@ contract CharityApplications is MultiSigGeneric, StorageApplications, ICharityAp modifier proposalNotConfirmed(uint256 proposalId, address _owner) { require( !proposalConfirmations[proposalId].confirmationsByOwner[_owner], - "Proposal is not confirmed" + "Proposal is already confirmed" ); _; } diff --git a/tasks/deploy/deployLocalRegistrar.ts b/tasks/deploy/deployLocalRegistrar.ts index ace0b71f5..e6f464972 100644 --- a/tasks/deploy/deployLocalRegistrar.ts +++ b/tasks/deploy/deployLocalRegistrar.ts @@ -4,7 +4,6 @@ import {task} from "hardhat/config"; import { confirmAction, getAddresses, - getNetworkNameFromChainId, getSigners, isLocalNetwork, logger, diff --git a/tasks/helpers/updateRegistrar.ts b/tasks/helpers/updateRegistrar.ts index a9cf99621..28efc6d88 100644 --- a/tasks/helpers/updateRegistrar.ts +++ b/tasks/helpers/updateRegistrar.ts @@ -6,7 +6,7 @@ import { } from "typechain-types/contracts/core/registrar/interfaces/IRegistrar"; import { NetworkConnectionAction, - getChainId, + getAxlNetworkName, getNetworkNameFromChainId, getSigners, logger, @@ -29,8 +29,7 @@ export async function updateRegistrarNetworkConnections( networkName = getNetworkNameFromChainId(Number(networkInfo.chainId)); } else { // we're updating this chains own network info and can safely lookup chain id - const chainId = await getChainId(hre); - networkName = getNetworkNameFromChainId(chainId); + networkName = await getAxlNetworkName(hre); } logger.out(`Updating Registrar network info for chain: ${networkName}`); diff --git a/utils/networkHelpers.ts b/utils/networkHelpers.ts index 35fc62519..f08cfdd94 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 getAxlNetworkName(hre: HardhatRuntimeEnvironment): Promise { + const chainId = await getChainId(hre); + return AxelarNetworks.get(chainId); +} + export async function getChainId(hre: HardhatRuntimeEnvironment): Promise { const chainId = (await hre.ethers.provider.getNetwork()).chainId; return chainId;