Skip to content

Commit

Permalink
feat: configure HyperlaneCCIPDeployer in infra
Browse files Browse the repository at this point in the history
  • Loading branch information
paulbalaji committed Feb 11, 2025
1 parent cf20d31 commit 91f7ea8
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 6 deletions.
14 changes: 14 additions & 0 deletions typescript/infra/config/environments/mainnet3/ccip.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { ChainMap, ChainName, getCCIPChains } from '@hyperlane-xyz/sdk';

export function getCCIPDeployConfig(
targetNetworks: ChainName[],
): ChainMap<Set<ChainName>> {
const ccipConfig: ChainMap<Set<ChainName>> = {};
const chains = getCCIPChains().filter((chain) =>
targetNetworks.includes(chain),
);
for (const origin of chains) {
ccipConfig[origin] = new Set(chains.filter((chain) => chain !== origin));
}
return ccipConfig;
}
2 changes: 2 additions & 0 deletions typescript/infra/scripts/agent-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export enum Modules {
HELLO_WORLD = 'helloworld',
WARP = 'warp',
HAAS = 'haas',
CCIP = 'ccip',
}

export const REGISTRY_MODULES = [
Expand All @@ -82,6 +83,7 @@ export const REGISTRY_MODULES = [
Modules.INTERCHAIN_QUERY_SYSTEM,
Modules.TEST_RECIPIENT,
Modules.HOOK,
Modules.CCIP,
];

export function getArgs() {
Expand Down
25 changes: 19 additions & 6 deletions typescript/infra/scripts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
ContractVerifier,
ExplorerLicenseType,
HypERC20Deployer,
HyperlaneCCIPDeployer,
HyperlaneCoreDeployer,
HyperlaneDeployer,
HyperlaneHookDeployer,
Expand All @@ -24,6 +25,7 @@ import {
import { objFilter, objMap } from '@hyperlane-xyz/utils';

import { Contexts } from '../config/contexts.js';
import { getCCIPDeployConfig } from '../config/environments/mainnet3/ccip.js';
import { core as coreConfig } from '../config/environments/mainnet3/core.js';
import { getEnvAddresses } from '../config/registry.js';
import { getWarpConfig } from '../config/warp.js';
Expand Down Expand Up @@ -79,6 +81,13 @@ async function main() {
chains,
);

const targetNetworks =
chains && chains.length > 0 ? chains : !fork ? [] : [fork];

const filteredTargetNetworks = targetNetworks.filter(
(chain) => !chainsToSkip.includes(chain),
);

if (fork) {
multiProvider = multiProvider.extendChainMetadata({
[fork]: { blocks: { confirmations: 0 } },
Expand Down Expand Up @@ -241,6 +250,16 @@ async function main() {
config = {
ethereum: coreConfig.ethereum.defaultHook,
};
} else if (module === Modules.CCIP) {
if (environment !== 'mainnet3') {
throw new Error('CCIP is only supported on mainnet3');
}
config = getCCIPDeployConfig(filteredTargetNetworks);
deployer = new HyperlaneCCIPDeployer(
multiProvider,
getEnvAddresses(environment),
contractVerifier,
);
} else {
console.log(`Skipping ${module}, deployer unimplemented`);
return;
Expand Down Expand Up @@ -284,12 +303,6 @@ async function main() {
}
}

const targetNetworks =
chains && chains.length > 0 ? chains : !fork ? [] : [fork];

const filteredTargetNetworks = targetNetworks.filter(
(chain) => !chainsToSkip.includes(chain),
);
chainsToSkip.forEach((chain) => delete config[chain]);

await deployWithArtifacts({
Expand Down
1 change: 1 addition & 0 deletions typescript/sdk/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -648,3 +648,4 @@ export {
getCCIPRouterAddress,
getCCIPChains,
} from './ccip/utils.js';
export { HyperlaneCCIPDeployer } from './ccip/HyperlaneCCIPDeployer.js';

0 comments on commit 91f7ea8

Please sign in to comment.