diff --git a/typescript/infra/config/environments/mainnet3/warp/configGetters/getRenzoEZETHWarpConfig.ts b/typescript/infra/config/environments/mainnet3/warp/configGetters/getRenzoEZETHWarpConfig.ts index 93ea7df1ef..6180dbe929 100644 --- a/typescript/infra/config/environments/mainnet3/warp/configGetters/getRenzoEZETHWarpConfig.ts +++ b/typescript/infra/config/environments/mainnet3/warp/configGetters/getRenzoEZETHWarpConfig.ts @@ -19,7 +19,7 @@ import { getRegistry as getMainnet3Registry } from '../../chains.js'; import rawTokenPrices from '../../tokenPrices.json'; const tokenPrices: ChainMap = rawTokenPrices; -const chainsToDeploy = [ +export const chainsToDeploy = [ 'arbitrum', 'optimism', 'base', @@ -279,100 +279,110 @@ const existingProxyAdmins: ChainMap<{ address: string; owner: string }> = { }, }; -export const getRenzoEZETHWarpConfig = async (): Promise< - ChainMap -> => { - const config = getEnvironmentConfig('mainnet3'); - const multiProvider = await config.getMultiProvider(); - const registry = await getMainnet3Registry(); +export const getRenzoEZETHWarpConfig = getRenzoEZETHWarpConfigGenerator( + ezEthSafes, + xERC20, +); - const validatorDiff = symmetricDifference( - new Set(chainsToDeploy), - new Set(Object.keys(ezEthValidators)), - ); - const safeDiff = symmetricDifference( - new Set(chainsToDeploy), - new Set(Object.keys(ezEthSafes)), - ); - const xERC20Diff = symmetricDifference( - new Set(chainsToDeploy), - new Set(Object.keys(xERC20)), - ); - if (validatorDiff.size > 0) { - throw new Error( - `chainsToDeploy !== validatorConfig, diff is ${Array.from( - validatorDiff, - ).join(', ')}`, +export function getRenzoEZETHWarpConfigGenerator( + ezEthSafes: Record, + xERC20: Record<(typeof chainsToDeploy)[number], string>, +) { + return async (): Promise> => { + const config = getEnvironmentConfig('mainnet3'); + const multiProvider = await config.getMultiProvider(); + const registry = await getMainnet3Registry(); + + const validatorDiff = symmetricDifference( + new Set(chainsToDeploy), + new Set(Object.keys(ezEthValidators)), ); - } - if (safeDiff.size > 0) { - throw new Error( - `chainsToDeploy !== safeDiff, diff is ${Array.from(safeDiff).join(', ')}`, + const safeDiff = symmetricDifference( + new Set(chainsToDeploy), + new Set(Object.keys(ezEthSafes)), ); - } - if (xERC20Diff.size > 0) { - throw new Error( - `chainsToDeploy !== xERC20Diff, diff is ${Array.from(xERC20Diff).join( - ', ', - )}`, + const xERC20Diff = symmetricDifference( + new Set(chainsToDeploy), + new Set(Object.keys(xERC20)), ); - } + 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( + ', ', + )}`, + ); + } + if (xERC20Diff.size > 0) { + throw new Error( + `chainsToDeploy !== xERC20Diff, diff is ${Array.from(xERC20Diff).join( + ', ', + )}`, + ); + } - const tokenConfig = Object.fromEntries( - 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 tokenConfig = Object.fromEntries( + 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[chain], - owner: ezEthSafes[chain], - gas: warpRouteOverheadGas, + const mailboxContract = Mailbox__factory.connect( mailbox, - interchainSecurityModule: { - type: IsmType.AGGREGATION, - threshold: 2, - modules: [ - { - type: IsmType.ROUTING, - owner: ezEthSafes[chain], - domains: buildAggregationIsmConfigs( - chain, - chainsToDeploy, - ezEthValidators, - ), - }, - { - type: IsmType.FALLBACK_ROUTING, - domains: {}, - owner: ezEthSafes[chain], - }, - ], + 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[chain], + owner: ezEthSafes[chain], + gas: warpRouteOverheadGas, + mailbox, + interchainSecurityModule: { + type: IsmType.AGGREGATION, + threshold: 2, + modules: [ + { + type: IsmType.ROUTING, + owner: ezEthSafes[chain], + domains: buildAggregationIsmConfigs( + chain, + chainsToDeploy, + ezEthValidators, + ), + }, + { + type: IsmType.FALLBACK_ROUTING, + domains: {}, + owner: ezEthSafes[chain], + }, + ], + }, + hook: getRenzoHook(defaultHook, chain), + proxyAdmin: existingProxyAdmins[chain], }, - hook: getRenzoHook(defaultHook, chain), - proxyAdmin: existingProxyAdmins[chain], - }, - ]; + ]; - return ret; - }, + return ret; + }, + ), ), - ), - ); + ); - return tokenConfig; -}; + return tokenConfig; + }; +} diff --git a/typescript/infra/config/environments/mainnet3/warp/configGetters/getRenzoEZETHWarpStagingConfig.ts b/typescript/infra/config/environments/mainnet3/warp/configGetters/getRenzoEZETHWarpStagingConfig.ts new file mode 100644 index 0000000000..6cf944636a --- /dev/null +++ b/typescript/infra/config/environments/mainnet3/warp/configGetters/getRenzoEZETHWarpStagingConfig.ts @@ -0,0 +1,41 @@ +import { + chainsToDeploy, + getRenzoEZETHWarpConfigGenerator, +} from './getRenzoEZETHWarpConfig.js'; + +const xERC20: Record<(typeof chainsToDeploy)[number], string> = { + arbitrum: '0x2416092f143378750bb29b79eD961ab195CcEea5', + optimism: '0x2416092f143378750bb29b79eD961ab195CcEea5', + base: '0x2416092f143378750bb29b79eD961ab195CcEea5', + blast: '0x2416092f143378750bb29b79eD961ab195CcEea5', + bsc: '0x2416092f143378750bb29b79eD961ab195CcEea5', + mode: '0x2416092f143378750bb29b79eD961ab195CcEea5', + linea: '0x2416092f143378750bb29b79eD961ab195CcEea5', + ethereum: '0x2416092f143378750bb29b79eD961ab195CcEea5', + fraxtal: '0x2416092f143378750bb29b79eD961ab195CcEea5', + zircuit: '0x2416092f143378750bb29b79eD961ab195CcEea5', + taiko: '0x2416092f143378750bb29b79eD961ab195CcEea5', + sei: '0x6DCfbF4729890043DFd34A93A2694E5303BA2703', // redEth + swell: '0x2416092f143378750bb29b79eD961ab195CcEea5', +}; + +export const ezEthSafes: Record = { + arbitrum: '0x0e60fd361fF5b90088e1782e6b21A7D177d462C5', + optimism: '0x8410927C286A38883BC23721e640F31D3E3E79F8', + base: '0x8410927C286A38883BC23721e640F31D3E3E79F8', + blast: '0xda7dBF0DB81882372B598a715F86eD5254A01b0a', + bsc: '0x0e60fd361fF5b90088e1782e6b21A7D177d462C5', + mode: '0x7791eeA3484Ba4E5860B7a2293840767619c2B58', + linea: '0xb7092685571B49786F1248c6205B5ac3A691c65E', + ethereum: '0xD1e6626310fD54Eceb5b9a51dA2eC329D6D4B68A', + fraxtal: '0x8410927C286A38883BC23721e640F31D3E3E79F8', + zircuit: '0x8410927C286A38883BC23721e640F31D3E3E79F8', + taiko: '0x8410927C286A38883BC23721e640F31D3E3E79F8', + sei: '0x0e60fd361fF5b90088e1782e6b21A7D177d462C5', + swell: '0x435E8c9652Da151292F3981bbf663EBEB6668501', +}; + +export const getRenzoEZETHWarpStagingConfig = getRenzoEZETHWarpConfigGenerator( + ezEthSafes, + xERC20, +);