diff --git a/packages/deployments/contracts/src/cli/init/helpers/assets.ts b/packages/deployments/contracts/src/cli/init/helpers/assets.ts index 25a5eb07e5..1d3ff12a03 100644 --- a/packages/deployments/contracts/src/cli/init/helpers/assets.ts +++ b/packages/deployments/contracts/src/cli/init/helpers/assets.ts @@ -61,28 +61,31 @@ export const setupAsset = async (args: { throw new Error(`Unable to find canonical decimals in config for ${asset.name}`); } - await updateIfNeeded({ - apply, - deployment: home.deployments.Connext, - desired: asset.canonical.address, - read: { method: "canonicalToAdopted(bytes32)", args: [key] }, - auth: [ - { method: "owner", eval: (ret: string) => ret.toLowerCase() === home.signerAddress }, - { method: "queryRole", args: [home.signerAddress], eval: (ret) => ret === 3 }, - ], - write: { - method: "setupAsset", - args: [ - [canonical.domain, canonical.id], - canonicalDecimals, - tokenName, - tokenSymbol, - asset.canonical.address, - constants.AddressZero, - asset.canonical.cap ?? "0", // 0-cap allowed on testnet only + // Note: bypassing in case of pseudo canonical domain + if (home.domain !== "11111") { + await updateIfNeeded({ + apply, + deployment: home.deployments.Connext, + desired: asset.canonical.address, + read: { method: "canonicalToAdopted(bytes32)", args: [key] }, + auth: [ + { method: "owner", eval: (ret: string) => ret.toLowerCase() === home.signerAddress }, + { method: "queryRole", args: [home.signerAddress], eval: (ret) => ret === 3 }, ], - }, - }); + write: { + method: "setupAsset", + args: [ + [canonical.domain, canonical.id], + canonicalDecimals, + tokenName, + tokenSymbol, + asset.canonical.address, + constants.AddressZero, + asset.canonical.cap ?? "0", // 0-cap allowed on testnet only + ], + }, + }); + } // Set up all the representational assets on their respective domains. for (const [domain, representation] of Object.entries(asset.representations)) { diff --git a/packages/deployments/contracts/src/cli/init/init.ts b/packages/deployments/contracts/src/cli/init/init.ts index 4268becc7d..8da46a64b0 100644 --- a/packages/deployments/contracts/src/cli/init/init.ts +++ b/packages/deployments/contracts/src/cli/init/init.ts @@ -1,9 +1,9 @@ import * as fs from "fs"; -import { providers, Wallet, utils, constants } from "ethers"; +import { providers, Wallet, utils, constants, ethers } from "ethers"; import * as zk from "zksync-ethers"; import commandLineArgs from "command-line-args"; -import { ajv, domainToChainId, getGelatoRelayerAddress, getChainData } from "@connext/nxtp-utils"; +import { ajv, domainToChainId, getGelatoRelayerAddress, getChainData, mkAddress } from "@connext/nxtp-utils"; import { HttpNetworkUserConfig } from "hardhat/types"; import { canonizeId } from "../../domain"; @@ -21,6 +21,7 @@ import { SpokeMessagingDeployments, setupAsset, setupMessaging, + DomainDeployments, } from "./helpers"; import { DEFAULT_INIT_CONFIG } from "./config"; @@ -164,6 +165,7 @@ export const sanitizeAndInit = async () => { } } + let deployer; // Get deployments for each domain if not specified in the config. for (const domain of domains) { const chainId = domainToChainId(Number(domain)); @@ -177,7 +179,7 @@ export const sanitizeAndInit = async () => { } // Convert deployer from mnemonic to Wallet. - let deployer; + if (privateKey) { deployer = chainConfig.zksync ? new zk.Wallet(privateKey) : new Wallet(privateKey); } else { @@ -210,6 +212,17 @@ export const sanitizeAndInit = async () => { }); } + // adding pseudo domain config in networks + + networks.push({ + signerAddress: mkAddress("pseudo"), + chain: "11111", + domain: "11111", + rpc: new providers.JsonRpcProvider("https://dummmy.com"), + deployments: {} as DomainDeployments, + relayerFeeVault: mkAddress("pseudo"), + }); + const sanitized = { hub: hubDomain, networks,