Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: deploy pzEth staging #5079

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@ import { assert, symmetricDifference } from '@hyperlane-xyz/utils';

import { getEnvironmentConfig } from '../../../../../scripts/core-utils.js';
import { getRegistry as getMainnet3Registry } from '../../chains.js';
import { safes } from '../../owners.js';

import {
ezEthSafes,
ezEthValidators,
getRenzoHook,
} from './getRenzoEZETHWarpConfig.js';

const lockbox = '0xbC5511354C4A9a50DE928F56DB01DD327c4e56d5';
const xERC20 = '0x9cb41CD74D01ae4b4f640EC40f7A60cA1bCF83E7';
const lockboxChain = 'ethereum';
// over the default 100k to account for xerc20 gas + ISM overhead over the default ISM https://github.com/hyperlane-xyz/hyperlane-monorepo/blob/49f41d9759fd515bfd89e6e22e799c41b27b4119/typescript/sdk/src/router/GasRouterDeployer.ts#L14
const warpRouteOverheadGas = 200_000;
Expand All @@ -31,26 +30,140 @@ const pzEthValidators = {
swell: ezEthValidators.swell,
};

const pzEthSafes: Record<string, string> = {
ethereum: ezEthSafes.ethereum,
zircuit: ezEthSafes.zircuit,
swell: ezEthSafes.swell,
};
export const getRenzoPZETHWarpConfig = async (): Promise<
ChainMap<HypTokenRouterConfig>
> => {
const lockbox = '0xbC5511354C4A9a50DE928F56DB01DD327c4e56d5';
const xERC20 = '0x9cb41CD74D01ae4b4f640EC40f7A60cA1bCF83E7';

const pzEthSafes: Record<string, string> = {
ethereum: ezEthSafes.ethereum,
zircuit: ezEthSafes.zircuit,
swell: ezEthSafes.swell,
};

const existingProxyAdmins: ChainMap<{ address: string; owner: string }> = {
ethereum: {
address: '0x4f4671Ce69c9af15e33eB7Cf6D1358d1B39Af3bF',
owner: '0xD1e6626310fD54Eceb5b9a51dA2eC329D6D4B68A',
},
zircuit: {
address: '0x8b789B4A56675240c9f0985B467752b870c75711',
owner: '0x8410927C286A38883BC23721e640F31D3E3E79F8',
},
};

const existingProxyAdmins: ChainMap<{ address: string; owner: string }> = {
ethereum: {
address: '0x4f4671Ce69c9af15e33eB7Cf6D1358d1B39Af3bF',
owner: '0xD1e6626310fD54Eceb5b9a51dA2eC329D6D4B68A',
},
zircuit: {
address: '0x8b789B4A56675240c9f0985B467752b870c75711',
owner: '0x8410927C286A38883BC23721e640F31D3E3E79F8',
},
Comment on lines -40 to -48
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why was this removed?

const config = getEnvironmentConfig('mainnet3');
const multiProvider = await config.getMultiProvider();
const registry = await getMainnet3Registry();

const validatorDiff = symmetricDifference(
new Set(chainsToDeploy),
new Set(Object.keys(pzEthValidators)),
);
const safeDiff = symmetricDifference(
new Set(chainsToDeploy),
new Set(Object.keys(pzEthSafes)),
);
if (validatorDiff.size > 0) {
throw new Error(
`chainsToDeploy !== validatorConfig, diff is ${Array.from(
validatorDiff,
).join(', ')}`,
);
}
if (safeDiff.size > 0) {
throw new Error(
`chainsToDeploy !== safeDiff, diff is ${Array.from(safeDiff).join(', ')}`,
);
}

const tokenConfig = Object.fromEntries<HypTokenRouterConfig>(
await Promise.all(
chainsToDeploy.map(
async (chain): Promise<[string, HypTokenRouterConfig]> => {
const addresses = await registry.getChainAddresses(chain);
assert(addresses, 'No addresses in Registry');
const { mailbox } = addresses;

const mailboxContract = Mailbox__factory.connect(
mailbox,
multiProvider.getProvider(chain),
);
const defaultHook = await mailboxContract.defaultHook();
const ret: [string, HypTokenRouterConfig] = [
chain,
{
isNft: false,
type:
chain === lockboxChain
? TokenType.XERC20Lockbox
: TokenType.XERC20,
token: chain === lockboxChain ? lockbox : xERC20,
owner: pzEthSafes[chain],
gas: warpRouteOverheadGas,
mailbox,
interchainSecurityModule: {
type: IsmType.AGGREGATION,
threshold: 2,
modules: [
{
type: IsmType.ROUTING,
owner: pzEthSafes[chain],
domains: buildAggregationIsmConfigs(
chain,
chainsToDeploy,
pzEthValidators,
),
},
{
type: IsmType.FALLBACK_ROUTING,
domains: {},
owner: pzEthSafes[chain],
},
],
},
hook: getRenzoHook(defaultHook, chain),
proxyAdmin: existingProxyAdmins[chain],
},
];

return ret;
},
),
),
);
Comment on lines +81 to +135
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this changing so much?
can we have 1 PR just to setup staging with an identical config and a separate PR for value changes?


return tokenConfig;
};

export const getRenzoPZETHWarpConfig = async (): Promise<
export const getRenzoPZETHWarpConfigStaging = async (): Promise<
ChainMap<HypTokenRouterConfig>
> => {
const lockbox = '0xbC5511354C4A9a50DE928F56DB01DD327c4e56d5'; // TODO
const xERC20 = '0x9cb41CD74D01ae4b4f640EC40f7A60cA1bCF83E7'; // TODO

// TODO DEPLOY REAL ONES
const stagingSafes = {
ethereum: '0xA9421c6F339eC414b7e77449986bE9C2Ae430C25',
bsc: '0xA9421c6F339eC414b7e77449986bE9C2Ae430C25',
arbitrum: '0xA9421c6F339eC414b7e77449986bE9C2Ae430C25',
optimism: '0xA9421c6F339eC414b7e77449986bE9C2Ae430C25',
blast: '0xA9421c6F339eC414b7e77449986bE9C2Ae430C25',
linea: '0xA9421c6F339eC414b7e77449986bE9C2Ae430C25',
base: '0xA9421c6F339eC414b7e77449986bE9C2Ae430C25',
mode: '0xf40b75fb85C3bEc70D75A1B45ef08FC48Db61115',
swell: '0xf40b75fb85C3bEc70D75A1B45ef08FC48Db61115',
fraxtal: '0xf40b75fb85C3bEc70D75A1B45ef08FC48Db61115',
zircuit: '0xf40b75fb85C3bEc70D75A1B45ef08FC48Db61115',
};
Comment on lines +146 to +159
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe overly optimistic but I feel like we dont need to test with safes and fine to use the deployer key as owner?


const pzEthSafes: Record<string, string> = {
ethereum: stagingSafes.ethereum,
zircuit: stagingSafes.zircuit,
swell: stagingSafes.swell,
};

const config = getEnvironmentConfig('mainnet3');
const multiProvider = await config.getMultiProvider();
const registry = await getMainnet3Registry();
Expand Down Expand Up @@ -122,7 +235,6 @@ export const getRenzoPZETHWarpConfig = async (): Promise<
],
},
hook: getRenzoHook(defaultHook, chain),
proxyAdmin: existingProxyAdmins[chain],
},
];

Expand Down
Loading