feat(cli): added proxy admin and ica router ownership configurability to core init command

xeno/ica-router-management
xeno097 1 month ago
parent 8082d178ba
commit cf5f0aa71e
  1. 39
      typescript/cli/src/config/core.ts
  2. 1
      typescript/cli/src/deploy/core.ts
  3. 9
      typescript/sdk/src/core/schemas.ts

@ -1,6 +1,11 @@
import { stringify as yamlStringify } from 'yaml';
import { CoreConfigSchema, HookConfig, IsmConfig } from '@hyperlane-xyz/sdk';
import {
CoreConfigSchema,
HookConfig,
IsmConfig,
OwnableConfig,
} from '@hyperlane-xyz/sdk';
import { CommandContext } from '../context/types.js';
import { errorRed, log, logBlue, logGreen } from '../logger.js';
@ -18,6 +23,9 @@ import {
} from './hooks.js';
import { createAdvancedIsmConfig, createTrustedRelayerConfig } from './ism.js';
const ENTER_DESIRED_VALUE_MSG = 'Enter the desired';
const SIGNER_PROMPT_LABEL = 'signer';
export async function createCoreDeployConfig({
context,
configFilePath,
@ -31,9 +39,9 @@ export async function createCoreDeployConfig({
const owner = await detectAndConfirmOrPrompt(
async () => context.signer?.getAddress(),
'Enter the desired',
ENTER_DESIRED_VALUE_MSG,
'owner address',
'signer',
SIGNER_PROMPT_LABEL,
);
const defaultIsm: IsmConfig = advanced
@ -41,6 +49,7 @@ export async function createCoreDeployConfig({
: await createTrustedRelayerConfig(context, advanced);
let defaultHook: HookConfig, requiredHook: HookConfig;
let proxyAdmin: OwnableConfig, interchainAccountRouter: OwnableConfig;
if (advanced) {
defaultHook = await createHookConfig({
context,
@ -52,9 +61,31 @@ export async function createCoreDeployConfig({
selectMessage: 'Select required hook type',
advanced,
});
proxyAdmin = {
owner: await detectAndConfirmOrPrompt(
async () => context.signer?.getAddress(),
ENTER_DESIRED_VALUE_MSG,
'ProxyAdmin owner address',
SIGNER_PROMPT_LABEL,
),
};
interchainAccountRouter = {
owner: await detectAndConfirmOrPrompt(
async () => context.signer?.getAddress(),
ENTER_DESIRED_VALUE_MSG,
'ICA Router owner address',
SIGNER_PROMPT_LABEL,
),
};
} else {
defaultHook = await createMerkleTreeConfig();
requiredHook = await createProtocolFeeConfig(context, advanced);
proxyAdmin = {
owner,
};
interchainAccountRouter = {
owner,
};
}
try {
@ -63,6 +94,8 @@ export async function createCoreDeployConfig({
defaultIsm,
defaultHook,
requiredHook,
proxyAdmin,
interchainAccountRouter,
});
logBlue(`Core config is valid, writing to file ${configFilePath}:\n`);
log(indentYamlOrJson(yamlStringify(coreConfig, null, 2), 4));

@ -34,6 +34,7 @@ interface DeployParams {
interface ApplyParams extends DeployParams {
deployedCoreAddresses: DeployedCoreAddresses;
}
/**
* Executes the core deploy command.
*/

@ -1,6 +1,9 @@
import { z } from 'zod';
import { ProxyFactoryFactoriesSchema } from '../deploy/schemas.js';
import {
OwnableConfigSchema,
ProxyFactoryFactoriesSchema,
} from '../deploy/schemas.js';
import { HookConfigSchema } from '../hook/schemas.js';
import { IsmConfigSchema } from '../ism/schemas.js';
import { OwnableSchema } from '../schemas.js';
@ -9,6 +12,10 @@ export const CoreConfigSchema = OwnableSchema.extend({
defaultIsm: IsmConfigSchema,
defaultHook: HookConfigSchema,
requiredHook: HookConfigSchema,
// These fields are set as optional because the old core config
// did not have them and we want to maintain backward compatibility
proxyAdmin: OwnableConfigSchema.optional(),
interchainAccountRouter: OwnableConfigSchema.optional(),
});
export const DeployedCoreAddressesSchema = ProxyFactoryFactoriesSchema.extend({

Loading…
Cancel
Save