@hyperlane-xyz/deploy-sdk 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/dist/AltVMCoreModule.d.ts +94 -0
  2. package/dist/AltVMCoreModule.d.ts.map +1 -0
  3. package/dist/AltVMCoreModule.js +328 -0
  4. package/dist/AltVMCoreModule.js.map +1 -0
  5. package/dist/AltVMCoreReader.d.ts +17 -0
  6. package/dist/AltVMCoreReader.d.ts.map +1 -0
  7. package/dist/AltVMCoreReader.js +31 -0
  8. package/dist/AltVMCoreReader.js.map +1 -0
  9. package/dist/AltVMHookModule.d.ts +41 -0
  10. package/dist/AltVMHookModule.d.ts.map +1 -0
  11. package/dist/AltVMHookModule.js +176 -0
  12. package/dist/AltVMHookModule.js.map +1 -0
  13. package/dist/AltVMHookReader.d.ts +17 -0
  14. package/dist/AltVMHookReader.d.ts.map +1 -0
  15. package/dist/AltVMHookReader.js +76 -0
  16. package/dist/AltVMHookReader.js.map +1 -0
  17. package/dist/AltVMIsmModule.d.ts +41 -0
  18. package/dist/AltVMIsmModule.d.ts.map +1 -0
  19. package/dist/AltVMIsmModule.js +255 -0
  20. package/dist/AltVMIsmModule.js.map +1 -0
  21. package/dist/AltVMIsmReader.d.ts +19 -0
  22. package/dist/AltVMIsmReader.d.ts.map +1 -0
  23. package/dist/AltVMIsmReader.js +101 -0
  24. package/dist/AltVMIsmReader.js.map +1 -0
  25. package/dist/AltVMWarpDeployer.d.ts +14 -0
  26. package/dist/AltVMWarpDeployer.d.ts.map +1 -0
  27. package/dist/AltVMWarpDeployer.js +69 -0
  28. package/dist/AltVMWarpDeployer.js.map +1 -0
  29. package/dist/AltVMWarpModule.d.ts +96 -0
  30. package/dist/AltVMWarpModule.d.ts.map +1 -0
  31. package/dist/AltVMWarpModule.js +329 -0
  32. package/dist/AltVMWarpModule.js.map +1 -0
  33. package/dist/AltVMWarpModule.test.d.ts +2 -0
  34. package/dist/AltVMWarpModule.test.d.ts.map +1 -0
  35. package/dist/AltVMWarpModule.test.js +403 -0
  36. package/dist/AltVMWarpModule.test.js.map +1 -0
  37. package/dist/AltVMWarpRouteReader.d.ts +52 -0
  38. package/dist/AltVMWarpRouteReader.d.ts.map +1 -0
  39. package/dist/AltVMWarpRouteReader.js +145 -0
  40. package/dist/AltVMWarpRouteReader.js.map +1 -0
  41. package/dist/core-module.d.ts +5 -0
  42. package/dist/core-module.d.ts.map +1 -0
  43. package/dist/core-module.js +28 -0
  44. package/dist/core-module.js.map +1 -0
  45. package/dist/hook-module.d.ts +5 -0
  46. package/dist/hook-module.d.ts.map +1 -0
  47. package/dist/hook-module.js +35 -0
  48. package/dist/hook-module.js.map +1 -0
  49. package/dist/index.d.ts +16 -0
  50. package/dist/index.d.ts.map +1 -0
  51. package/dist/index.js +16 -0
  52. package/dist/index.js.map +1 -0
  53. package/dist/ism-module.d.ts +5 -0
  54. package/dist/ism-module.d.ts.map +1 -0
  55. package/dist/ism-module.js +35 -0
  56. package/dist/ism-module.js.map +1 -0
  57. package/dist/protocol.d.ts +3 -0
  58. package/dist/protocol.d.ts.map +1 -0
  59. package/dist/protocol.js +23 -0
  60. package/dist/protocol.js.map +1 -0
  61. package/dist/utils/validation.d.ts +37 -0
  62. package/dist/utils/validation.d.ts.map +1 -0
  63. package/dist/utils/validation.js +66 -0
  64. package/dist/utils/validation.js.map +1 -0
  65. package/dist/warp-module.d.ts +5 -0
  66. package/dist/warp-module.d.ts.map +1 -0
  67. package/dist/warp-module.js +28 -0
  68. package/dist/warp-module.js.map +1 -0
  69. package/package.json +46 -0
@@ -0,0 +1,101 @@
1
+ import { AltVM } from '@hyperlane-xyz/provider-sdk';
2
+ import { rootLogger } from '@hyperlane-xyz/utils';
3
+ export class AltVMIsmReader {
4
+ getChainName;
5
+ provider;
6
+ logger = rootLogger.child({
7
+ module: 'AltVMIsmReader',
8
+ });
9
+ constructor(getChainName, provider) {
10
+ this.getChainName = getChainName;
11
+ this.provider = provider;
12
+ }
13
+ async read(address) {
14
+ return this.deriveIsmConfig(address);
15
+ }
16
+ async deriveIsmConfigFromAddress(address) {
17
+ try {
18
+ const ism_type = await this.provider.getIsmType({ ismAddress: address });
19
+ this.logger.debug(`Deriving ISM config with type ${ism_type} for address: ${address}`);
20
+ switch (ism_type) {
21
+ case AltVM.IsmType.MERKLE_ROOT_MULTISIG:
22
+ return this.deriveMerkleRootMultisigConfig(address);
23
+ case AltVM.IsmType.MESSAGE_ID_MULTISIG:
24
+ return this.deriveMessageIdMultisigConfig(address);
25
+ case AltVM.IsmType.ROUTING:
26
+ return this.deriveRoutingConfig(address);
27
+ case AltVM.IsmType.TEST_ISM:
28
+ return this.deriveTestConfig(address);
29
+ default:
30
+ throw new Error(`Unknown ISM ModuleType: ${ism_type}`);
31
+ }
32
+ }
33
+ catch (error) {
34
+ this.logger.error(`Failed to derive ISM config for ${address}`, error);
35
+ throw error;
36
+ }
37
+ }
38
+ async deriveIsmConfig(config) {
39
+ if (typeof config === 'string')
40
+ return this.deriveIsmConfigFromAddress(config);
41
+ // Extend the inner isms
42
+ switch (config.type) {
43
+ case 'domainRoutingIsm':
44
+ for (const [chain, ism] of Object.entries(config.domains)) {
45
+ config.domains[chain] = await this.deriveIsmConfig(ism);
46
+ }
47
+ break;
48
+ }
49
+ return config;
50
+ }
51
+ async deriveMerkleRootMultisigConfig(address) {
52
+ const ism = await this.provider.getMerkleRootMultisigIsm({
53
+ ismAddress: address,
54
+ });
55
+ return {
56
+ type: 'merkleRootMultisigIsm',
57
+ address,
58
+ validators: ism.validators,
59
+ threshold: ism.threshold,
60
+ };
61
+ }
62
+ async deriveMessageIdMultisigConfig(address) {
63
+ const ism = await this.provider.getMessageIdMultisigIsm({
64
+ ismAddress: address,
65
+ });
66
+ return {
67
+ type: 'messageIdMultisigIsm',
68
+ address,
69
+ validators: ism.validators,
70
+ threshold: ism.threshold,
71
+ };
72
+ }
73
+ async deriveRoutingConfig(address) {
74
+ const ism = await this.provider.getRoutingIsm({
75
+ ismAddress: address,
76
+ });
77
+ const domains = {};
78
+ for (const route of ism.routes) {
79
+ this.logger.debug(`Deriving ism config for route with domain id ${route.domainId}`);
80
+ const chainName = this.getChainName(route.domainId);
81
+ if (!chainName) {
82
+ this.logger.warn(`Unknown domain ID ${route.domainId}, skipping domain configuration`);
83
+ continue;
84
+ }
85
+ domains[chainName] = await this.deriveIsmConfig(route.ismAddress);
86
+ }
87
+ return {
88
+ type: 'domainRoutingIsm',
89
+ address,
90
+ owner: ism.owner,
91
+ domains,
92
+ };
93
+ }
94
+ async deriveTestConfig(address) {
95
+ return {
96
+ type: 'testIsm',
97
+ address,
98
+ };
99
+ }
100
+ }
101
+ //# sourceMappingURL=AltVMIsmReader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AltVMIsmReader.js","sourceRoot":"","sources":["../src/AltVMIsmReader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAUpD,OAAO,EAAgC,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEhF,MAAM,OAAO,cAAc;IAMJ;IACA;IANF,MAAM,GAAW,UAAU,CAAC,KAAK,CAAC;QACnD,MAAM,EAAE,gBAAgB;KACzB,CAAC,CAAC;IAEH,YACqB,YAA6B,EAC7B,QAAyB;QADzB,iBAAY,GAAZ,YAAY,CAAiB;QAC7B,aAAQ,GAAR,QAAQ,CAAiB;IAC3C,CAAC;IAEJ,KAAK,CAAC,IAAI,CAAC,OAAe;QACxB,OAAO,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC;IAED,KAAK,CAAC,0BAA0B,CAC9B,OAAgB;QAEhB,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,CAAC;YAEzE,IAAI,CAAC,MAAM,CAAC,KAAK,CACf,iCAAiC,QAAQ,i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AAK,CAAC,UAAU,CAAC,CAAC;QACpE,CAAC;QAED,OAAO;YACL,IAAI,EAAE,kBAAkB;YACxB,OAAO;YACP,KAAK,EAAE,GAAG,CAAC,KAAK;YAChB,OAAO;SACR,CAAC;IACJ,CAAC;IAEO,KAAK,CAAC,gBAAgB,CAAC,OAAgB;QAC7C,OAAO;YACL,IAAI,EAAE,SAAS;YACf,OAAO;SACR,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,14 @@
1
+ import { AltVM } from '@hyperlane-xyz/provider-sdk';
2
+ import { AnnotatedTx, TxReceipt } from '@hyperlane-xyz/provider-sdk/module';
3
+ import { WarpConfig } from '@hyperlane-xyz/provider-sdk/warp';
4
+ import { Address, rootLogger } from '@hyperlane-xyz/utils';
5
+ export declare class AltVMDeployer {
6
+ protected readonly signersMap: Record<string, AltVM.ISigner<AnnotatedTx, TxReceipt>>;
7
+ protected logger: ReturnType<typeof rootLogger.child<never>>;
8
+ constructor(signersMap: Record<string, AltVM.ISigner<AnnotatedTx, TxReceipt>>);
9
+ deploy(configMap: Record<string, WarpConfig>): Promise<Record<string, Address>>;
10
+ private deployNativeToken;
11
+ private deployCollateralToken;
12
+ private deploySyntheticToken;
13
+ }
14
+ //# sourceMappingURL=AltVMWarpDeployer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AltVMWarpDeployer.d.ts","sourceRoot":"","sources":["../src/AltVMWarpDeployer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAa,UAAU,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,OAAO,EAAU,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEnE,qBAAa,aAAa;IAItB,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CACnC,MAAM,EACN,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,SAAS,CAAC,CACtC;IANH,SAAS,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;gBAGxC,UAAU,EAAE,MAAM,CACnC,MAAM,EACN,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,SAAS,CAAC,CACtC;IAKG,MAAM,CACV,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GACpC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAoDrB,iBAAiB;YAWjB,qBAAqB;YAerB,oBAAoB;CAgBnC"}
@@ -0,0 +1,69 @@
1
+ import { TokenType } from '@hyperlane-xyz/provider-sdk/warp';
2
+ import { assert, rootLogger } from '@hyperlane-xyz/utils';
3
+ export class AltVMDeployer {
4
+ signersMap;
5
+ logger;
6
+ constructor(signersMap) {
7
+ this.signersMap = signersMap;
8
+ this.logger = rootLogger.child({ module: 'AltVMDeployer' });
9
+ }
10
+ async deploy(configMap) {
11
+ const result = {};
12
+ for (const chain of Object.keys(configMap)) {
13
+ const config = configMap[chain];
14
+ assert(this.signersMap[chain], `No signer configured for ${chain}`);
15
+ assert(config, `No config configured for ${chain}`);
16
+ this.logger.info(`Deploying ${config.type} token to chain ${chain}`);
17
+ if (config.type === TokenType.native) {
18
+ result[chain] = await this.deployNativeToken(chain, config.mailbox);
19
+ }
20
+ else if (config.type === TokenType.collateral) {
21
+ result[chain] = await this.deployCollateralToken(chain, config.mailbox, config.token);
22
+ }
23
+ else if (config.type === TokenType.synthetic) {
24
+ result[chain] = await this.deploySyntheticToken(chain, config.mailbox, config.name, config.symbol, config.decimals);
25
+ }
26
+ else {
27
+ // This should never happen with proper type guards above
28
+ const exhaustiveCheck = config;
29
+ throw new Error(`Token type ${exhaustiveCheck.type} not supported on chain ${chain}`);
30
+ }
31
+ if (config.interchainSecurityModule &&
32
+ typeof config.interchainSecurityModule === 'string') {
33
+ this.logger.info(`Set ISM for token`);
34
+ await this.signersMap[chain].setTokenIsm({
35
+ tokenAddress: result[chain],
36
+ ismAddress: config.interchainSecurityModule,
37
+ });
38
+ }
39
+ this.logger.info(`Successfully deployed contracts on ${chain}`);
40
+ }
41
+ return result;
42
+ }
43
+ async deployNativeToken(chain, originMailbox) {
44
+ this.logger.info(`Deploying native token to ${chain}`);
45
+ const { tokenAddress } = await this.signersMap[chain].createNativeToken({
46
+ mailboxAddress: originMailbox,
47
+ });
48
+ return tokenAddress;
49
+ }
50
+ async deployCollateralToken(chain, originMailbox, originDenom) {
51
+ this.logger.info(`Deploying collateral token to ${chain}`);
52
+ const { tokenAddress } = await this.signersMap[chain].createCollateralToken({
53
+ mailboxAddress: originMailbox,
54
+ collateralDenom: originDenom,
55
+ });
56
+ return tokenAddress;
57
+ }
58
+ async deploySyntheticToken(chain, originMailbox, name, denom, decimals) {
59
+ this.logger.info(`Deploying synthetic token to ${chain}`);
60
+ const { tokenAddress } = await this.signersMap[chain].createSyntheticToken({
61
+ mailboxAddress: originMailbox,
62
+ name: name || '',
63
+ denom: denom || '',
64
+ decimals: decimals || 0,
65
+ });
66
+ return tokenAddress;
67
+ }
68
+ }
69
+ //# sourceMappingURL=AltVMWarpDeployer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AltVMWarpDeployer.js","sourceRoot":"","sources":["../src/AltVMWarpDeployer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAc,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAW,MAAM,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEnE,MAAM,OAAO,aAAa;IAIH;IAHX,MAAM,CAA6C;IAE7D,YACqB,UAGlB;QAHkB,eAAU,GAAV,UAAU,CAG5B;QAED,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC,CAAC;IAC9D,CAAC;IAED,KAAK,CAAC,MAAM,CACV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B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gCAAgC,KAAK,EAAE,CAAC,CAAC;QAC1D,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,oBAAoB,CAAC;YACzE,cAAc,EAAE,aAAa;YAC7B,IAAI,EAAE,IAAI,IAAI,EAAE;YAChB,KAAK,EAAE,KAAK,IAAI,EAAE;YAClB,QAAQ,EAAE,QAAQ,IAAI,CAAC;SACxB,CAAC,CAAC;QACH,OAAO,YAAY,CAAC;IACtB,CAAC;CACF"}
@@ -0,0 +1,96 @@
1
+ import { AltVM } from '@hyperlane-xyz/provider-sdk';
2
+ import { ChainLookup } from '@hyperlane-xyz/provider-sdk/chain';
3
+ import { AnnotatedTx, HypModule, HypModuleArgs, TxReceipt } from '@hyperlane-xyz/provider-sdk/module';
4
+ import { DerivedWarpConfig, TokenRouterModuleType, WarpConfig, WarpRouteAddresses } from '@hyperlane-xyz/provider-sdk/warp';
5
+ import { Address, rootLogger } from '@hyperlane-xyz/utils';
6
+ import { AltVMWarpRouteReader } from './AltVMWarpRouteReader.js';
7
+ export declare class AltVMWarpModule implements HypModule<TokenRouterModuleType> {
8
+ protected readonly chainLookup: ChainLookup;
9
+ protected readonly signer: AltVM.ISigner<AnnotatedTx, TxReceipt>;
10
+ private readonly args;
11
+ protected logger: ReturnType<typeof rootLogger.child<never>>;
12
+ reader: AltVMWarpRouteReader;
13
+ readonly chainName: string;
14
+ constructor(chainLookup: ChainLookup, signer: AltVM.ISigner<AnnotatedTx, TxReceipt>, args: HypModuleArgs<TokenRouterModuleType>);
15
+ /**
16
+ * Retrieves the token router configuration for the specified address.
17
+ *
18
+ * @param address - The address to derive the token router configuration from.
19
+ * @returns A promise that resolves to the token router configuration.
20
+ */
21
+ read(): Promise<DerivedWarpConfig>;
22
+ serialize(): WarpRouteAddresses;
23
+ /**
24
+ * Updates the Warp Route contract with the provided configuration.
25
+ *
26
+ * @param expectedConfig - The configuration for the token router to be updated.
27
+ * @returns An array of transactions that were executed to update the contract, or an error if the update failed.
28
+ */
29
+ update(expectedConfig: WarpConfig): Promise<AnnotatedTx[]>;
30
+ /**
31
+ * Create transactions to update the remote routers for the Warp Route contract.
32
+ *
33
+ * @param actualConfig - The on-chain router configuration, including the remoteRouters array.
34
+ * @param expectedConfig - The expected token router configuration.
35
+ * @returns An array with transactions that need to be executed to enroll the routers
36
+ */
37
+ createRemoteRouterUpdateTxs(actualConfig: DerivedWarpConfig, expectedConfig: WarpConfig): Promise<AnnotatedTx[]>;
38
+ /**
39
+ * Create transactions to update an existing ISM config, or deploy a new ISM and return a tx to setInterchainSecurityModule
40
+ *
41
+ * @param actualConfig - The on-chain router configuration, including the ISM configuration, and address.
42
+ * @param expectedConfig - The expected token router configuration, including the ISM configuration.
43
+ * @returns transaction that need to be executed to update the ISM configuration.
44
+ */
45
+ createIsmUpdateTxs(actualConfig: DerivedWarpConfig, expectedConfig: WarpConfig): Promise<AnnotatedTx[]>;
46
+ /**
47
+ * Create transactions to update an existing Hook config, or deploy a new Hook and return a tx to setHook
48
+ *
49
+ * @param actualConfig - The on-chain router configuration, including the ISM configuration, and address.
50
+ * @param expectedConfig - The expected token router configuration, including the ISM configuration.
51
+ * @returns transaction that need to be executed to update the ISM configuration.
52
+ */
53
+ createHookUpdateTxs(actualConfig: DerivedWarpConfig, expectedConfig: WarpConfig): Promise<AnnotatedTx[]>;
54
+ /**
55
+ * Transfer ownership of an existing Warp route with a given config.
56
+ *
57
+ * @param actualConfig - The on-chain router configuration.
58
+ * @param expectedConfig - The expected token router configuration.
59
+ * @returns transaction that need to be executed to update the owner.
60
+ */
61
+ createOwnershipUpdateTxs(actualConfig: DerivedWarpConfig, expectedConfig: WarpConfig): Promise<AnnotatedTx[]>;
62
+ /**
63
+ * Updates or deploys the ISM using the provided configuration.
64
+ *
65
+ * @returns Object with deployedIsm address, and update Transactions
66
+ */
67
+ deployOrUpdateIsm(actualConfig: DerivedWarpConfig, expectedConfig: WarpConfig): Promise<{
68
+ deployedIsm: Address;
69
+ updateTransactions: AnnotatedTx[];
70
+ }>;
71
+ /**
72
+ * Updates or deploys the Hook using the provided configuration.
73
+ *
74
+ * @returns Object with deployedHook address, and update Transactions
75
+ */
76
+ deployOrUpdateHook(actualConfig: DerivedWarpConfig, expectedConfig: WarpConfig): Promise<{
77
+ deployedHook: Address;
78
+ updateTransactions: AnnotatedTx[];
79
+ }>;
80
+ /**
81
+ * Deploys the Warp Route.
82
+ *
83
+ * @param chain - The chain to deploy the module on.
84
+ * @param config - The configuration for the token router.
85
+ * @param chainLookup - Chain metadata lookup functions
86
+ * @param signer - The AltVM signing client
87
+ * @returns A new instance of the AltVMWarpModule.
88
+ */
89
+ static create(params: {
90
+ chain: string;
91
+ config: WarpConfig;
92
+ chainLookup: ChainLookup;
93
+ signer: AltVM.ISigner<AnnotatedTx, TxReceipt>;
94
+ }): Promise<AltVMWarpModule>;
95
+ }
96
+ //# sourceMappingURL=AltVMWarpModule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AltVMWarpModule.d.ts","sourceRoot":"","sources":["../src/AltVMWarpModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAGhE,OAAO,EACL,WAAW,EACX,SAAS,EACT,aAAa,EACb,SAAS,EACV,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,UAAU,EACV,kBAAkB,EACnB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,OAAO,EAIP,UAAU,EACX,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAGjE,qBAAa,eAAgB,YAAW,SAAS,CAAC,qBAAqB,CAAC;IAOpE,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,WAAW;IAC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,kBAAkB,EAAE,WAAW,EAAE,CAAC;KACnC,CAAC;IAsCF;;;;OAIG;IACG,kBAAkB,CACtB,YAAY,EAAE,iBAAiB,EAC/B,cAAc,EAAE,UAAU,GACzB,OAAO,CAAC;QACT,YAAY,EAAE,OAAO,CAAC;QACtB,kBAAkB,EAAE,WAAW,EAAE,CAAC;KACnC,CAAC;IA2BF;;;;;;;;OAQG;WACU,MAAM,CAAC,MAAM,EAAE;QAC1B,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,UAAU,CAAC;QACnB,WAAW,EAAE,WAAW,CAAC;QACzB,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;KAC/C,GAAG,OAAO,CAAC,eAAe,CAAC;CAiB7B"}
@@ -0,0 +1,329 @@
1
+ import { addressToBytes32, assert, isZeroishAddress, rootLogger, } from '@hyperlane-xyz/utils';
2
+ import { AltVMHookModule } from './AltVMHookModule.js';
3
+ import { AltVMIsmModule } from './AltVMIsmModule.js';
4
+ import { AltVMDeployer } from './AltVMWarpDeployer.js';
5
+ import { AltVMWarpRouteReader } from './AltVMWarpRouteReader.js';
6
+ import { validateIsmConfig } from './utils/validation.js';
7
+ export class AltVMWarpModule {
8
+ chainLookup;
9
+ signer;
10
+ args;
11
+ logger;
12
+ reader;
13
+ chainName;
14
+ constructor(chainLookup, signer, args) {
15
+ this.chainLookup = chainLookup;
16
+ this.signer = signer;
17
+ this.args = args;
18
+ const metadata = chainLookup.getChainMetadata(args.chain);
19
+ this.chainName = metadata.name;
20
+ this.reader = new AltVMWarpRouteReader(chainLookup, signer);
21
+ this.logger = rootLogger.child({
22
+ module: AltVMWarpModule.name,
23
+ });
24
+ }
25
+ /**
26
+ * Retrieves the token router configuration for the specified address.
27
+ *
28
+ * @param address - The address to derive the token router configuration from.
29
+ * @returns A promise that resolves to the token router configuration.
30
+ */
31
+ async read() {
32
+ return this.reader.deriveWarpRouteConfig(this.args.addresses.deployedTokenRoute);
33
+ }
34
+ serialize() {
35
+ return this.args.addresses;
36
+ }
37
+ /**
38
+ * Updates the Warp Route contract with the provided configuration.
39
+ *
40
+ * @param expectedConfig - The configuration for the token router to be updated.
41
+ * @returns An array of transactions that were executed to update the contract, or an error if the update failed.
42
+ */
43
+ async update(expectedConfig) {
44
+ const actualConfig = await this.read();
45
+ const transactions = [];
46
+ /**
47
+ * @remark
48
+ * The order of operations matter
49
+ * createOwnershipUpdateTxs() must always be LAST because no updates possible after ownership transferred
50
+ */
51
+ transactions.push(...(await this.createIsmUpdateTxs(actualConfig, expectedConfig)), ...(await this.createHookUpdateTxs(actualConfig, expectedConfig)), ...(await this.createRemoteRouterUpdateTxs(actualConfig, expectedConfig)), ...(await this.createOwnershipUpdateTxs(actualConfig, expectedConfig)));
52
+ return transactions;
53
+ }
54
+ /**
55
+ * Create transactions to update the remote routers for the Warp Route contract.
56
+ *
57
+ * @param actualConfig - The on-chain router configuration, including the remoteRouters array.
58
+ * @param expectedConfig - The expected token router configuration.
59
+ * @returns An array with transactions that need to be executed to enroll the routers
60
+ */
61
+ async createRemoteRouterUpdateTxs(actualConfig, expectedConfig) {
62
+ this.logger.debug(`Start creating remote router update transactions`);
63
+ const updateTransactions = [];
64
+ if (!expectedConfig.remoteRouters) {
65
+ return [];
66
+ }
67
+ assert(actualConfig.remoteRouters, 'actualRemoteRouters is undefined');
68
+ assert(expectedConfig.remoteRouters, 'expectedRemoteRouters is undefined');
69
+ assert(actualConfig.destinationGas, 'actualDestinationGas is undefined');
70
+ assert(expectedConfig.destinationGas, 'expectedDestinationGas is undefined');
71
+ const { remoteRouters: actualRemoteRouters } = actualConfig;
72
+ const { remoteRouters: expectedRemoteRouters } = expectedConfig;
73
+ const { destinationGas: actualDestinationGas } = actualConfig;
74
+ const { destinationGas: expectedDestinationGas } = expectedConfig;
75
+ // perform checks if domain Ids match between remote router
76
+ // and destination gas configs
77
+ const actualRemoteRoutersString = Object.keys(actualRemoteRouters)
78
+ .sort()
79
+ .toString();
80
+ const actualDestinationGasString = Object.keys(actualDestinationGas)
81
+ .sort()
82
+ .toString();
83
+ const expectedRemoteRoutersString = Object.keys(expectedRemoteRouters)
84
+ .sort()
85
+ .toString();
86
+ const expectedDestinationGasString = Object.keys(expectedDestinationGas)
87
+ .sort()
88
+ .toString();
89
+ assert(actualRemoteRoutersString === actualDestinationGasString, `domain Ids from actual remote router config differ from actual destination gas config: ${actualRemoteRoutersString} : ${actualDestinationGasString}`);
90
+ assert(expectedRemoteRoutersString === expectedDestinationGasString, `domain Ids from expected remote router config differ from actual destination gas config: ${expectedRemoteRoutersString} : ${expectedDestinationGasString}`);
91
+ const routesToEnroll = [];
92
+ const routesToUnenroll = [];
93
+ // get domain Ids where we need to enroll, if the address
94
+ // or the gas updates inside a remote route we need to unenroll
95
+ // and enroll again
96
+ for (const domainId of Object.keys(expectedRemoteRouters)) {
97
+ if (!actualRemoteRouters[domainId]) {
98
+ routesToEnroll.push(domainId);
99
+ continue;
100
+ }
101
+ if (actualRemoteRouters[domainId].address !==
102
+ expectedRemoteRouters[domainId].address) {
103
+ routesToEnroll.push(domainId);
104
+ routesToUnenroll.push(domainId);
105
+ continue;
106
+ }
107
+ if (actualDestinationGas[domainId] !== expectedDestinationGas[domainId]) {
108
+ routesToEnroll.push(domainId);
109
+ routesToUnenroll.push(domainId);
110
+ continue;
111
+ }
112
+ }
113
+ // get domain Ids where we need to unenroll
114
+ for (const domainId of Object.keys(actualRemoteRouters)) {
115
+ if (!expectedRemoteRouters[domainId]) {
116
+ routesToUnenroll.push(domainId);
117
+ }
118
+ }
119
+ if (routesToEnroll.length === 0 && routesToUnenroll.length === 0) {
120
+ this.logger.debug(`No routes to change. No updates needed.`);
121
+ return [];
122
+ }
123
+ // first be unenroll all routes that need to be unenrolled,
124
+ // afterwards we enroll again
125
+ for (const domainId of routesToUnenroll) {
126
+ updateTransactions.push({
127
+ annotation: `Unenrolling Router ${this.args.addresses.deployedTokenRoute} on ${this.args.chain}`,
128
+ ...(await this.signer.getUnenrollRemoteRouterTransaction({
129
+ signer: actualConfig.owner,
130
+ tokenAddress: this.args.addresses.deployedTokenRoute,
131
+ receiverDomainId: parseInt(domainId),
132
+ })),
133
+ });
134
+ }
135
+ for (const domainId of routesToEnroll) {
136
+ updateTransactions.push({
137
+ annotation: `Enrolling Router ${this.args.addresses.deployedTokenRoute} on ${this.args.chain}`,
138
+ ...(await this.signer.getEnrollRemoteRouterTransaction({
139
+ signer: actualConfig.owner,
140
+ tokenAddress: this.args.addresses.deployedTokenRoute,
141
+ remoteRouter: {
142
+ receiverDomainId: parseInt(domainId),
143
+ receiverAddress: addressToBytes32(expectedRemoteRouters[domainId].address),
144
+ gas: expectedDestinationGas[domainId],
145
+ },
146
+ })),
147
+ });
148
+ }
149
+ this.logger.debug(`Created ${updateTransactions.length} remote router update transactions.`);
150
+ return updateTransactions;
151
+ }
152
+ /**
153
+ * Create transactions to update an existing ISM config, or deploy a new ISM and return a tx to setInterchainSecurityModule
154
+ *
155
+ * @param actualConfig - The on-chain router configuration, including the ISM configuration, and address.
156
+ * @param expectedConfig - The expected token router configuration, including the ISM configuration.
157
+ * @returns transaction that need to be executed to update the ISM configuration.
158
+ */
159
+ async createIsmUpdateTxs(actualConfig, expectedConfig) {
160
+ this.logger.debug(`Start creating token ISM update transactions`);
161
+ const updateTransactions = [];
162
+ if (actualConfig.interchainSecurityModule ===
163
+ expectedConfig.interchainSecurityModule) {
164
+ this.logger.debug(`Token ISM config is the same as target. No updates needed.`);
165
+ return updateTransactions;
166
+ }
167
+ if (!expectedConfig.interchainSecurityModule ||
168
+ (typeof expectedConfig.interchainSecurityModule === 'string' &&
169
+ isZeroishAddress(expectedConfig.interchainSecurityModule))) {
170
+ this.logger.debug(`Token ISM config is empty. No updates needed.`);
171
+ return updateTransactions;
172
+ }
173
+ const actualDeployedIsm = actualConfig.interchainSecurityModule?.address ??
174
+ '';
175
+ // Try to update (may also deploy) Ism with the expected config
176
+ const { deployedIsm: expectedDeployedIsm, updateTransactions: ismUpdateTransactions, } = await this.deployOrUpdateIsm(actualConfig, expectedConfig);
177
+ // If an ISM is updated in-place, push the update txs
178
+ updateTransactions.push(...ismUpdateTransactions);
179
+ // If a new ISM is deployed, push the setInterchainSecurityModule tx
180
+ if (actualDeployedIsm !== expectedDeployedIsm) {
181
+ updateTransactions.push({
182
+ annotation: `Setting ISM for Warp Route to ${expectedDeployedIsm}`,
183
+ ...(await this.signer.getSetTokenIsmTransaction({
184
+ signer: actualConfig.owner,
185
+ tokenAddress: this.args.addresses.deployedTokenRoute,
186
+ ismAddress: expectedDeployedIsm,
187
+ })),
188
+ });
189
+ }
190
+ this.logger.debug(`Created ${updateTransactions.length} update token ISM transactions.`);
191
+ return updateTransactions;
192
+ }
193
+ /**
194
+ * Create transactions to update an existing Hook config, or deploy a new Hook and return a tx to setHook
195
+ *
196
+ * @param actualConfig - The on-chain router configuration, including the ISM configuration, and address.
197
+ * @param expectedConfig - The expected token router configuration, including the ISM configuration.
198
+ * @returns transaction that need to be executed to update the ISM configuration.
199
+ */
200
+ async createHookUpdateTxs(actualConfig, expectedConfig) {
201
+ this.logger.debug(`Start creating token Hook update transactions`);
202
+ const updateTransactions = [];
203
+ if (actualConfig.hook === expectedConfig.hook) {
204
+ this.logger.debug(`Token Hook config is the same as target. No updates needed.`);
205
+ return updateTransactions;
206
+ }
207
+ if (!expectedConfig.hook ||
208
+ (typeof expectedConfig.hook === 'string' &&
209
+ isZeroishAddress(expectedConfig.hook))) {
210
+ this.logger.debug(`Token Hook config is empty. No updates needed.`);
211
+ return updateTransactions;
212
+ }
213
+ const actualDeployedHook = actualConfig.hook?.address ?? '';
214
+ // Try to update (may also deploy) Hook with the expected config
215
+ const { deployedHook: expectedDeployedHook, updateTransactions: hookUpdateTransactions, } = await this.deployOrUpdateHook(actualConfig, expectedConfig);
216
+ // If an Hook is updated in-place, push the update txs
217
+ updateTransactions.push(...hookUpdateTransactions);
218
+ // If a new Hook is deployed, push the setHook tx
219
+ if (actualDeployedHook !== expectedDeployedHook) {
220
+ updateTransactions.push({
221
+ annotation: `Setting Hook for Warp Route to ${expectedDeployedHook}`,
222
+ ...(await this.signer.getSetTokenHookTransaction({
223
+ signer: actualConfig.owner,
224
+ tokenAddress: this.args.addresses.deployedTokenRoute,
225
+ hookAddress: expectedDeployedHook,
226
+ })),
227
+ });
228
+ }
229
+ this.logger.debug(`Created ${updateTransactions.length} update token Hook transactions.`);
230
+ return updateTransactions;
231
+ }
232
+ /**
233
+ * Transfer ownership of an existing Warp route with a given config.
234
+ *
235
+ * @param actualConfig - The on-chain router configuration.
236
+ * @param expectedConfig - The expected token router configuration.
237
+ * @returns transaction that need to be executed to update the owner.
238
+ */
239
+ async createOwnershipUpdateTxs(actualConfig, expectedConfig) {
240
+ this.logger.debug(`Start creating token owner update transactions`);
241
+ if (actualConfig.owner === expectedConfig.owner) {
242
+ this.logger.debug(`Token owner is the same as target. No updates needed.`);
243
+ return [];
244
+ }
245
+ this.logger.debug(`Created 1 update token owner update transaction.`);
246
+ return [
247
+ {
248
+ annotation: `Transferring ownership of ${this.args.addresses.deployedTokenRoute} from ${actualConfig.owner} to ${expectedConfig.owner}`,
249
+ ...(await this.signer.getSetTokenOwnerTransaction({
250
+ signer: actualConfig.owner,
251
+ tokenAddress: this.args.addresses.deployedTokenRoute,
252
+ newOwner: expectedConfig.owner,
253
+ })),
254
+ },
255
+ ];
256
+ }
257
+ /**
258
+ * Updates or deploys the ISM using the provided configuration.
259
+ *
260
+ * @returns Object with deployedIsm address, and update Transactions
261
+ */
262
+ async deployOrUpdateIsm(actualConfig, expectedConfig) {
263
+ this.logger.debug(`Start deploying token ISM`);
264
+ assert(expectedConfig.interchainSecurityModule, 'Ism derived incorrectly');
265
+ // Validate ISM configuration is supported by provider-sdk
266
+ validateIsmConfig(expectedConfig.interchainSecurityModule, this.chainName, 'warp route ISM');
267
+ const ismModule = new AltVMIsmModule(this.chainLookup, {
268
+ chain: this.args.chain,
269
+ config: expectedConfig.interchainSecurityModule,
270
+ addresses: {
271
+ ...this.args.addresses,
272
+ mailbox: expectedConfig.mailbox,
273
+ deployedIsm: actualConfig.interchainSecurityModule
274
+ ?.address ?? '',
275
+ },
276
+ }, this.signer);
277
+ this.logger.debug(`Comparing target ISM config with ${this.args.chain} chain`);
278
+ const updateTransactions = await ismModule.update(expectedConfig.interchainSecurityModule);
279
+ const { deployedIsm } = ismModule.serialize();
280
+ return { deployedIsm, updateTransactions };
281
+ }
282
+ /**
283
+ * Updates or deploys the Hook using the provided configuration.
284
+ *
285
+ * @returns Object with deployedHook address, and update Transactions
286
+ */
287
+ async deployOrUpdateHook(actualConfig, expectedConfig) {
288
+ this.logger.debug(`Start deploying token Hook`);
289
+ assert(expectedConfig.hook, 'Hook derived incorrectly');
290
+ const hookModule = new AltVMHookModule(this.chainLookup, {
291
+ chain: this.args.chain,
292
+ config: expectedConfig.hook,
293
+ addresses: {
294
+ ...this.args.addresses,
295
+ mailbox: expectedConfig.mailbox,
296
+ deployedHook: actualConfig.hook?.address ?? '',
297
+ },
298
+ }, this.signer);
299
+ this.logger.debug(`Comparing target Hook config with ${this.args.chain} chain`);
300
+ const updateTransactions = await hookModule.update(expectedConfig.hook);
301
+ const { deployedHook } = hookModule.serialize();
302
+ return { deployedHook, updateTransactions };
303
+ }
304
+ /**
305
+ * Deploys the Warp Route.
306
+ *
307
+ * @param chain - The chain to deploy the module on.
308
+ * @param config - The configuration for the token router.
309
+ * @param chainLookup - Chain metadata lookup functions
310
+ * @param signer - The AltVM signing client
311
+ * @returns A new instance of the AltVMWarpModule.
312
+ */
313
+ static async create(params) {
314
+ const deployer = new AltVMDeployer({
315
+ [params.chain]: params.signer,
316
+ });
317
+ const { [params.chain]: deployedTokenRoute } = await deployer.deploy({
318
+ [params.chain]: params.config,
319
+ });
320
+ return new AltVMWarpModule(params.chainLookup, params.signer, {
321
+ addresses: {
322
+ deployedTokenRoute,
323
+ },
324
+ chain: params.chain,
325
+ config: params.config,
326
+ });
327
+ }
328
+ }
329
+ //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