diff --git a/packages/deployments/contracts/src/cli/init/config/mainnet/production.ts b/packages/deployments/contracts/src/cli/init/config/mainnet/production.ts index b530f5c5fd..d7e2db6366 100644 --- a/packages/deployments/contracts/src/cli/init/config/mainnet/production.ts +++ b/packages/deployments/contracts/src/cli/init/config/mainnet/production.ts @@ -20,7 +20,7 @@ export const MAINNET_PRODUCTION_INIT_CONFIG: InitConfig = { "1635148152", // Avalanche "1835101812", // Mantle "1836016741", // Mode - "1935897199", // Scroll + // "1935897199", // Scroll ], // NOTE: ENSURE LPTOKEN AND BRIDGETOKEN NAMES ARE GENERATED CORRECTLY BASED // ON THE NAME GIVEN IN EACH ASSET ENTRY @@ -345,28 +345,6 @@ export const MAINNET_PRODUCTION_INIT_CONFIG: InitConfig = { }, }, }, - { - // TODO: This is the old config, to be removed in execution layer upgrade - name: "ALCX", - canonical: { - domain: "6648936", - address: "0xbd18f9be5675a9658335e6b7e79d9d9b394ac043", - decimals: 18, - cap: utils.parseUnits("10000000", 18).toString(), - }, - representations: { - /// ARBITRUM - "1634886255": { - local: "0x27b58D226fe8f792730a795764945Cf146815AA7", - adopted: "0x27b58D226fe8f792730a795764945Cf146815AA7", - }, - /// OPTIMISM - "1869640809": { - local: "0xE974B9b31dBFf4369b94a1bAB5e228f35ed44125", - adopted: "0xE974B9b31dBFf4369b94a1bAB5e228f35ed44125", - }, - }, - }, { name: "ALCX", canonical: { @@ -395,29 +373,12 @@ export const MAINNET_PRODUCTION_INIT_CONFIG: InitConfig = { }, { name: "XOC", - // polygon canonical: { - domain: "1886350457", + domain: "11111", address: "0xa411c9Aa00E020e4f88Bc19996d29c5B7ADB4ACf", decimals: 18, - cap: utils.parseUnits("25000", 18).toString(), }, representations: { - // mainnet - "6648936": { - local: "0x0000000000000000000000000000000000000000", - adopted: "0x0000000000000000000000000000000000000000", - }, - // optimism - "1869640809": { - local: "0x0000000000000000000000000000000000000000", - adopted: "0x0000000000000000000000000000000000000000", - }, - // arbitrum one - "1634886255": { - local: "0x0000000000000000000000000000000000000000", - adopted: "0x0000000000000000000000000000000000000000", - }, // bsc "6450786": { local: "0xa411c9Aa00E020e4f88Bc19996d29c5B7ADB4ACf", @@ -428,6 +389,11 @@ export const MAINNET_PRODUCTION_INIT_CONFIG: InitConfig = { local: "0xa411c9Aa00E020e4f88Bc19996d29c5B7ADB4ACf", adopted: "0xa411c9Aa00E020e4f88Bc19996d29c5B7ADB4ACf", }, + // polygon + "1886350457": { + local: "0xa411c9Aa00E020e4f88Bc19996d29c5B7ADB4ACf", + adopted: "0xa411c9Aa00E020e4f88Bc19996d29c5B7ADB4ACf", + }, }, }, { @@ -446,22 +412,6 @@ export const MAINNET_PRODUCTION_INIT_CONFIG: InitConfig = { }, }, }, - { - name: "xRADAR", - canonical: { - domain: "6648936", - address: "0x202426c15a18a0e0fE3294415E66421891E2EB7C", - decimals: 18, - cap: utils.parseUnits("10000000", 18).toString(), - }, - representations: { - /// BSC - "6450786": { - local: "0x489580eB70a50515296eF31E8179fF3e77E24965", - adopted: "0x489580eB70a50515296eF31E8179fF3e77E24965", - }, - }, - }, { name: "NEXT", canonical: { @@ -498,6 +448,87 @@ export const MAINNET_PRODUCTION_INIT_CONFIG: InitConfig = { }, }, }, + + { + name: "xRADAR", + canonical: { + domain: "11111", + address: "0x202426c15a18a0e0fE3294415E66421891E2EB7C", + decimals: 18, + }, + representations: { + /// MAINNET + "6648936": { + local: "0x202426c15a18a0e0fE3294415E66421891E2EB7C", + adopted: "0x202426c15a18a0e0fE3294415E66421891E2EB7C", + }, + /// BSC + "6450786": { + local: "0x489580eB70a50515296eF31E8179fF3e77E24965", + adopted: "0x489580eB70a50515296eF31E8179fF3e77E24965", + }, + /// Polygon + "1886350457": { + local: "0xdCb72AE4d5dc6Ae274461d57E65dB8D50d0a33AD", + adopted: "0xdCb72AE4d5dc6Ae274461d57E65dB8D50d0a33AD", + }, + }, + }, + { + name: "xoLIT", + canonical: { + domain: "11111", + address: "0x24F21b1864d4747a5c99045c96dA11DBFDa378f7", + decimals: 18, + }, + representations: { + /// ETHEREUM + "6648936": { + local: "0x24F21b1864d4747a5c99045c96dA11DBFDa378f7", + adopted: "0x24F21b1864d4747a5c99045c96dA11DBFDa378f7", + }, + /// ARBITRUM + "1634886255": { + local: "0x24F21b1864d4747a5c99045c96dA11DBFDa378f7", + adopted: "0x24F21b1864d4747a5c99045c96dA11DBFDa378f7", + }, + }, + }, + { + name: "ezETH", + canonical: { + domain: "11111", + address: "0x2416092f143378750bb29b79eD961ab195CcEea5", + decimals: 18, + }, + representations: { + /// ETHEREUM + "6648936": { + local: "0x2416092f143378750bb29b79eD961ab195CcEea5", + adopted: "0x2416092f143378750bb29b79eD961ab195CcEea5", + }, + /// ARBITRUM + "1634886255": { + local: "0x2416092f143378750bb29b79eD961ab195CcEea5", + adopted: "0x2416092f143378750bb29b79eD961ab195CcEea5", + }, + /// BNB + "6450786": { + local: "0x2416092f143378750bb29b79eD961ab195CcEea5", + adopted: "0x2416092f143378750bb29b79eD961ab195CcEea5", + }, + /// MODE + "1836016741": { + local: "0x2416092f143378750bb29b79eD961ab195CcEea5", + adopted: "0x2416092f143378750bb29b79eD961ab195CcEea5", + }, + /// LINEA + "1818848877": { + local: "0x2416092f143378750bb29b79eD961ab195CcEea5", + adopted: "0x2416092f143378750bb29b79eD961ab195CcEea5", + }, + }, + }, { name: "URUS", canonical: { @@ -639,56 +670,6 @@ export const MAINNET_PRODUCTION_INIT_CONFIG: InitConfig = { // BINANCE }, }, - { - name: "xoLIT", - canonical: { - domain: "11111", - address: "0x24F21b1864d4747a5c99045c96dA11DBFDa378f7", - decimals: 18, - }, - representations: { - /// ETHEREUM - "6648936": { - local: "0x24F21b1864d4747a5c99045c96dA11DBFDa378f7", - adopted: "0x24F21b1864d4747a5c99045c96dA11DBFDa378f7", - }, - /// ARBITRUM - "1634886255": { - local: "0x24F21b1864d4747a5c99045c96dA11DBFDa378f7", - adopted: "0x24F21b1864d4747a5c99045c96dA11DBFDa378f7", - }, - }, - }, - { - name: "ezETH", - canonical: { - domain: "11111", - address: "0x2416092f143378750bb29b79eD961ab195CcEea5", - decimals: 18, - }, - representations: { - /// ETHEREUM - "6648936": { - local: "0x2416092f143378750bb29b79eD961ab195CcEea5", - adopted: "0x2416092f143378750bb29b79eD961ab195CcEea5", - }, - /// ARBITRUM - "1634886255": { - local: "0x2416092f143378750bb29b79eD961ab195CcEea5", - adopted: "0x2416092f143378750bb29b79eD961ab195CcEea5", - }, - /// BNB - "6450786": { - local: "0x2416092f143378750bb29b79eD961ab195CcEea5", - adopted: "0x2416092f143378750bb29b79eD961ab195CcEea5", - }, - /// MODE - "1836016741": { - local: "0x2416092f143378750bb29b79eD961ab195CcEea5", - adopted: "0x2416092f143378750bb29b79eD961ab195CcEea5", - }, - }, - }, ], agents: { relayerFeeVaults: { diff --git a/packages/deployments/contracts/src/cli/init/config/testnet/production.ts b/packages/deployments/contracts/src/cli/init/config/testnet/production.ts index 9209426d38..c2934c4827 100644 --- a/packages/deployments/contracts/src/cli/init/config/testnet/production.ts +++ b/packages/deployments/contracts/src/cli/init/config/testnet/production.ts @@ -7,6 +7,7 @@ export const TESTNET_PRODUCTION_INIT_CONFIG: InitConfig = { "1735356532", /// OPTIMISM-GOERLI // "1734439522", /// ARBITRUM-GOERLI "9991", /// MUMBAI + "11111", // "2053862260", /// ZKSYNC-TEST // "1668247156", /// LINGEA-GOERLI // "1887071092", /// POLYGON-ZKEVM-TEST @@ -280,22 +281,143 @@ export const TESTNET_PRODUCTION_INIT_CONFIG: InitConfig = { }, }, { - name: "InrETH", + name: "TST", canonical: { + // Bogus domain domain: "11111", + address: "0x6Bc2F40ee04D45848BcD4A70DF6D3679FA2c2A30", + decimals: 18, + }, + representations: { + /// GOERLI + "1735353714": { + local: "0x6Bc2F40ee04D45848BcD4A70DF6D3679FA2c2A30", + adopted: "0x6Bc2F40ee04D45848BcD4A70DF6D3679FA2c2A30", + }, + /// OPTIMISM-GOERLI + "1735356532": { + local: "0x6Bc2F40ee04D45848BcD4A70DF6D3679FA2c2A30", + adopted: "0x6Bc2F40ee04D45848BcD4A70DF6D3679FA2c2A30", + }, + /// MUMBAI + "9991": { + local: "0x6Bc2F40ee04D45848BcD4A70DF6D3679FA2c2A30", + adopted: "0x6Bc2F40ee04D45848BcD4A70DF6D3679FA2c2A30", + }, + }, + }, + { + name: "BOG", + canonical: { + /// GOERLI + domain: "1735353714", + address: "0x3a3e4974FF0dA424276935d1e0c9587B5314ec31", + decimals: 18, + }, + representations: { + /// OPTIMISM-GOERLI + "1735356532": { + local: "0x3a3e4974FF0dA424276935d1e0c9587B5314ec31", + adopted: "0x3a3e4974FF0dA424276935d1e0c9587B5314ec31", + }, + /// MUMBAI + "9991": { + local: "0x3a3e4974FF0dA424276935d1e0c9587B5314ec31", + adopted: "0x3a3e4974FF0dA424276935d1e0c9587B5314ec31", + }, + }, + }, + { + // Comment out other "BOG" when running init for this + // TODO: we currently comment out the home chain setup logic in + // helpers/asset.ts when this is being init'd + name: "BOG", + canonical: { + // Bogus domain + domain: "11111", + address: "0x3a3e4974FF0dA424276935d1e0c9587B5314ec31", + decimals: 18, + }, + representations: { + /// GOERLI + "1735353714": { + local: "0x3a3e4974FF0dA424276935d1e0c9587B5314ec31", + adopted: "0x3a3e4974FF0dA424276935d1e0c9587B5314ec31", + }, + /// OPTIMISM-GOERLI + "1735356532": { + local: "0x3a3e4974FF0dA424276935d1e0c9587B5314ec31", + adopted: "0x3a3e4974FF0dA424276935d1e0c9587B5314ec31", + }, + /// MUMBAI + "9991": { + local: "0x3a3e4974FF0dA424276935d1e0c9587B5314ec31", + adopted: "0x3a3e4974FF0dA424276935d1e0c9587B5314ec31", + }, + }, + }, + { + name: "ESX", + canonical: { + domain: "11111", + address: "0x07d086Cc91BD3aad22C6ff76AFF6aefe15763258", + decimals: 9, + }, + representations: { + /// MUMBAI + "9991": { + local: "0x07d086Cc91BD3aad22C6ff76AFF6aefe15763258", + adopted: "0x07d086Cc91BD3aad22C6ff76AFF6aefe15763258", + }, + /// Goerli + "1735353714": { + local: "0x5EEee8B304Ad51447736F74A5675c2cB070e52A7", + adopted: "0x5EEee8B304Ad51447736F74A5675c2cB070e52A7", + }, + }, + }, + { + name: "sDAI", + canonical: { + domain: "11111", + address: "0x272DF088C3bDafeDCa5f66D76B1372A6091eFc64", decimals: 18, - address: "0xa66e9339418c1e85bc957062D8D75036dB97e57B", }, representations: { /// Goerli "1735353714": { - local: "0xa66e9339418c1e85bc957062D8D75036dB97e57B", - adopted: "0xa66e9339418c1e85bc957062D8D75036dB97e57B", + local: "0x272DF088C3bDafeDCa5f66D76B1372A6091eFc64", + adopted: "0x272DF088C3bDafeDCa5f66D76B1372A6091eFc64", + }, + /// Mumbai + "9991": { + local: "0x272DF088C3bDafeDCa5f66D76B1372A6091eFc64", + adopted: "0x272DF088C3bDafeDCa5f66D76B1372A6091eFc64", + }, + }, + }, + { + name: "GovernTest", + canonical: { + domain: "11111", + address: "0xb8F010bC74e4de27d9e69063F3faf5F7317831d3", + decimals: 18, + }, + representations: { + /// Goerli + "1735353714": { + local: "0xb8F010bC74e4de27d9e69063F3faf5F7317831d3", + adopted: "0xb8F010bC74e4de27d9e69063F3faf5F7317831d3", }, /// Mumbai "9991": { - local: "0x268734Ce4610c4445b7A9d12100Fc385B97362C6", - adopted: "0x268734Ce4610c4445b7A9d12100Fc385B97362C6", + local: "0xb8F010bC74e4de27d9e69063F3faf5F7317831d3", + adopted: "0xb8F010bC74e4de27d9e69063F3faf5F7317831d3", + }, + /// Linea + "1668247156": { + local: "0xB91471be67c8F2Ada2Cd36cA5EB439B017B80a37", + adopted: "0xB91471be67c8F2Ada2Cd36cA5EB439B017B80a37", }, }, }, diff --git a/packages/deployments/contracts/src/cli/init/helpers/assets.ts b/packages/deployments/contracts/src/cli/init/helpers/assets.ts index 25a5eb07e5..f43c1e2357 100644 --- a/packages/deployments/contracts/src/cli/init/helpers/assets.ts +++ b/packages/deployments/contracts/src/cli/init/helpers/assets.ts @@ -29,15 +29,6 @@ export const setupAsset = async (args: { `\n\tVerifying asset setup for ${asset.name} (${asset.canonical.address}). Canonical ID: ${canonical.id}; Canonical Domain: ${canonical.domain}; Key: ${key}`, ); - // Set up the canonical asset on the canonical domain. - const home = networks.find((n) => n.domain === asset.canonical.domain); - if (!home) { - throw new Error( - `Could not find canonical domain network ${asset.canonical.domain} for asset ${asset.canonical.address} in` + - "the configured list of networks!", - ); - } - let canonicalDecimals = asset.canonical.decimals; if (!canonicalDecimals) { const record = getAssetEntryFromChaindata(asset.canonical.address, asset.canonical.domain, chainData); @@ -53,37 +44,10 @@ export const setupAsset = async (args: { const tokenName = asset.name.startsWith(`next`) ? asset.name : `next${asset.name.toUpperCase()}`; const tokenSymbol = tokenName; - if (+home.chain === 1 && !useStaging && BigNumber.from(asset.canonical.cap ?? "0").isZero()) { - throw new Error(`Must have nonzero cap on prod canonical domains`); - } - if (!canonicalDecimals) { 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 - ], - }, - }); - // Set up all the representational assets on their respective domains. for (const [domain, representation] of Object.entries(asset.representations)) { if (!representation) continue; @@ -176,14 +140,6 @@ export const setupAsset = async (args: { } } - // NOTE: it is best practice to init + add liquidity in a single transaction to start the pool in a balanced state - if (apply && +home.chain === 1) { - // TODO: add liquidity with balance assertions; proper min to mint calculations; etc. - // Fixing this is useful in testnet, but on mainnets youre using safes anyway. - console.warn(`Must implement safe pool initialization. Skipping.`); - continue; - } - // After registering the asset, check pool status. const [local, adopted] = apply ? await getValue<[string, string]>({ diff --git a/packages/deployments/contracts/src/cli/init/init.ts b/packages/deployments/contracts/src/cli/init/init.ts index 4268becc7d..88af380f4b 100644 --- a/packages/deployments/contracts/src/cli/init/init.ts +++ b/packages/deployments/contracts/src/cli/init/init.ts @@ -131,7 +131,8 @@ export const sanitizeAndInit = async () => { }; for (const domain of domains) { - if (+domain === +asset.canonical.domain) continue; + // TODO: handle special case for setting up xERC20s with bogus canonical domain + // if (domain === hubDomain) continue; _extracted.representations[domain] = asset.representations[domain]; } @@ -166,48 +167,52 @@ export const sanitizeAndInit = async () => { // Get deployments for each domain if not specified in the config. for (const domain of domains) { - const chainId = domainToChainId(Number(domain)); + // TODO: handle special case for setting up xERC20s with bogus canonical domain + if (Number(domain) != 11111) { + const chainId = domainToChainId(Number(domain)); - const chainConfig = Object.values(filteredHardhatNetworks).find( - (networkConfig: any) => networkConfig["chainId"] == chainId, - ) as HttpNetworkUserConfig & { zksync: boolean | undefined }; + const chainConfig = Object.values(filteredHardhatNetworks).find( + (networkConfig: any) => networkConfig["chainId"] == chainId, + ) as HttpNetworkUserConfig & { zksync: boolean | undefined }; - if (!chainConfig || !chainConfig.url) { - throw new Error(`Not configured network for chainId: ${chainId} in hardhat config`); - } + if (!chainConfig || !chainConfig.url) { + throw new Error(`Not configured network for chainId: ${chainId} in hardhat config`); + } - // Convert deployer from mnemonic to Wallet. - let deployer; - if (privateKey) { - deployer = chainConfig.zksync ? new zk.Wallet(privateKey) : new Wallet(privateKey); - } else { - deployer = chainConfig.zksync ? zk.Wallet.fromMnemonic(mnemonic!) : Wallet.fromMnemonic(mnemonic!); - } - console.log(`domain: ${domain}, deployer: ${deployer.address}, rpc: ${chainConfig.url}`); + // Convert deployer from mnemonic to Wallet. + let deployer; + if (privateKey) { + deployer = chainConfig.zksync ? new zk.Wallet(privateKey) : new Wallet(privateKey); + } else { + deployer = chainConfig.zksync ? zk.Wallet.fromMnemonic(mnemonic!) : Wallet.fromMnemonic(mnemonic!); + } + console.log("deployer: ", deployer.address); - const rpc = chainConfig.zksync ? new zk.Provider(chainConfig.url) : new providers.JsonRpcProvider(chainConfig.url); + const rpc = chainConfig.zksync + ? new zk.Provider(chainConfig.url) + : new providers.JsonRpcProvider(chainConfig.url); - const isHub = domain === hubDomain; - const deployments = getDeployments({ - deployer, - chainInfo: { chain: chainId.toString(), rpc, zksync: chainConfig.zksync || false }, - isHub, - useStaging, - network, - }); + const isHub = domain === hubDomain; + const deployments = getDeployments({ + deployer, + chainInfo: { chain: chainId.toString(), rpc, zksync: chainConfig.zksync || false }, + isHub, + useStaging, + }); - // TODO: all agents should also be configured per-network - if (!initConfig.agents.relayerFeeVaults[domain]) { - throw new Error(`No relayer fee vault configured for ${domain}!`); - } - networks.push({ - signerAddress: deployer.address.toLowerCase(), + // TODO: all agents should also be configured per-network + if (!initConfig.agents.relayerFeeVaults[domain]) { + throw new Error(`No relayer fee vault configured for ${domain}!`); + } + networks.push({ + signerAddress: deployer.address.toLowerCase(), chain: chainId.toString(), - domain, - rpc, - deployments, - relayerFeeVault: initConfig.agents.relayerFeeVaults[domain], - }); + domain, + rpc, + deployments, + relayerFeeVault: initConfig.agents.relayerFeeVaults[domain], + }); + } } const sanitized = {