async function deployMultipleChains(chainConfigs) {
  // for each domain, deploy the entire contract suite,
  // including one replica for each other domain
  const chainDetails = {};

  let govRouters = [];
  for (let config of chainConfigs) {
    const { domain } = config;

    // for the given domain,
    // local is the single chainConfig for the chain at the given domain
    // remotes is an array of all other chains
    const { local, remotes } = separateLocalFromRemotes(chainConfigs, domain);

    // deploy contract suite for this chain
    // note: we will be working with a persistent set of contracts across each test
    const contracts = await devDeployOptics(local, remotes, true);

    const govRouter = contracts.governanceRouter.proxyWithImplementation;
    govRouters.push(govRouter);

    chainDetails[domain] = {
      ...config,
      contracts,
    };
  }

  // set the governor to the governance router deployed on the first chain
  const governorDomain = await chainConfigs[0].domain;
  const governor = await govRouters[0].governor();
  for (let i = 0; i < govRouters.length; i++) {
    for (let j = 0; j < govRouters.length; j++) {
      if (j !== i) {
        // set routers on every governance router
        const routerDomain = chainConfigs[j].domain;
        const routerAddress = govRouters[j].address;
        govRouters[i].setRouterAddress(routerDomain, routerAddress);
      }
    }
    if (i > 0) {
      // transfer governorship to first governance router
      govRouters[i].transferGovernor(governorDomain, governor);
    }
  }

  return chainDetails;
}
/*
 * Deploy the entire suite of Optics contracts
 * on each chain within the chainConfigs array
 * including the upgradable Home, Replicas, and GovernanceRouter
 * that have been deployed, initialized, and configured
 * according to the deployOptics script
 *
 * @param chainConfigs - ChainConfig[]
 *
 * @return chainDetails - ChainDetails type
 */
Deploy the entire suite of Optics contracts
on each chain within the chainConfigs array
including the upgradable Home, Replicas, and GovernanceRouter
that have been deployed, initialized, and configured
according to the deployOptics script

@param chainConfigs - ChainConfig[]

@return chainDetails - ChainDetails type
Deploy the entire suite of Optics contracts on each chain within the chainConfigs array including the upgradable Home Replicas and GovernanceRouter that have been deployed initialized and configured according to the deployOptics script @param chainConfigs - ChainConfig [] @return chainDetails - ChainDetails type
async function deployMultipleChains(chainConfigs) {
  const chainDetails = {};
  let govRouters = [];
  for (let config of chainConfigs) {
    const { domain } = config;
    const { local, remotes } = separateLocalFromRemotes(chainConfigs, domain);
    const contracts = await devDeployOptics(local, remotes, true);
    const govRouter = contracts.governanceRouter.proxyWithImplementation;
    govRouters.push(govRouter);
    chainDetails[domain] = {
      ...config,
      contracts,
    };
  }
  const governorDomain = await chainConfigs[0].domain;
  const governor = await govRouters[0].governor();
  for (let i = 0; i < govRouters.length; i++) {
    for (let j = 0; j < govRouters.length; j++) {
      if (j !== i) {
        const routerDomain = chainConfigs[j].domain;
        const routerAddress = govRouters[j].address;
        govRouters[i].setRouterAddress(routerDomain, routerAddress);
      }
    }
    if (i > 0) {
      govRouters[i].transferGovernor(governorDomain, governor);
    }
  }
  return chainDetails;
}
async function deployMultipleChains ( chainConfigs ) { const chainDetails = { } ; let govRouters = [ ] ; for ( let config of chainConfigs ) { const { domain } = config ; const { local , remotes } = separateLocalFromRemotes ( chainConfigs , domain ) ; const contracts = await devDeployOptics ( local , remotes , true ) ; const govRouter = contracts . governanceRouter . proxyWithImplementation ; govRouters . push ( govRouter ) ; chainDetails [ domain ] = { ... config , contracts , } ; } const governorDomain = await chainConfigs [ 0 ] . domain ; const governor = await govRouters [ 0 ] . governor ( ) ; for ( let i = 0 ; i < govRouters . length ; i ++ ) { for ( let j = 0 ; j < govRouters . length ; j ++ ) { if ( j !== i ) { const routerDomain = chainConfigs [ j ] . domain ; const routerAddress = govRouters [ j ] . address ; govRouters [ i ] . setRouterAddress ( routerDomain , routerAddress ) ; } } if ( i > 0 ) { govRouters [ i ] . transferGovernor ( governorDomain , governor ) ; } } return chainDetails ; }
Deploy the entire suite of Optics contracts
 on each chain within the chainConfigs array
 including the upgradable Home, Replicas, and GovernanceRouter
 that have been deployed, initialized, and configured
 according to the deployOptics script
Deploy the entire suite of Optics contracts on each chain within the chainConfigs array including the upgradable Home Replicas and GovernanceRouter that have been deployed initialized and configured according to the deployOptics script
// for each domain, deploy the entire contract suite, // including one replica for each other domain // for the given domain, // local is the single chainConfig for the chain at the given domain // remotes is an array of all other chains // deploy contract suite for this chain // note: we will be working with a persistent set of contracts across each test // set the governor to the governance router deployed on the first chain // set routers on every governance router // transfer governorship to first governance router