@@ -41,6 +41,11 @@ import { getBaseFee } from '@arbitrum/sdk/dist/lib/utils/lib'
4141import { RollupAdminLogic__factory } from '@arbitrum/sdk/dist/lib/abi/factories/RollupAdminLogic__factory'
4242import { ContractVerifier } from './contractVerifier'
4343
44+ /**
45+ * Dummy non-zero address which is provided to logic contracts initializers
46+ */
47+ const ADDRESS_DEAD = '0x000000000000000000000000000000000000dEaD'
48+
4449/**
4550 * Use already deployed L1TokenBridgeCreator to create and init token bridge contracts.
4651 * Function first gets estimates for 2 retryable tickets - one for deploying L2 factory and
@@ -237,7 +242,7 @@ export const createTokenBridge = async (
237242 l2Weth,
238243 beaconProxyFactory,
239244 l2ProxyAdmin,
240- l2Multicall
245+ l2Multicall,
241246 }
242247}
243248
@@ -304,40 +309,104 @@ export const deployL1TokenBridgeCreator = async (
304309 l1Deployer
305310 )
306311
312+ // initialize retryable sender logic contract
313+ await ( await retryableSenderLogic . initialize ( ) ) . wait ( )
314+
307315 /// init creator
308316 await ( await l1TokenBridgeCreator . initialize ( retryableSender . address ) ) . wait ( )
309317
310- /// deploy L1 logic contracts
318+ /// deploy L1 logic contracts. Initialize them with dummy data
311319 const routerTemplate = await new L1GatewayRouter__factory ( l1Deployer ) . deploy ( )
312320 await routerTemplate . deployed ( )
321+ await (
322+ await routerTemplate . initialize (
323+ ADDRESS_DEAD ,
324+ ADDRESS_DEAD ,
325+ ADDRESS_DEAD ,
326+ ADDRESS_DEAD ,
327+ ADDRESS_DEAD
328+ )
329+ ) . wait ( )
313330
314331 const standardGatewayTemplate = await new L1ERC20Gateway__factory (
315332 l1Deployer
316333 ) . deploy ( )
317334 await standardGatewayTemplate . deployed ( )
335+ await (
336+ await standardGatewayTemplate . initialize (
337+ ADDRESS_DEAD ,
338+ ADDRESS_DEAD ,
339+ ADDRESS_DEAD ,
340+ ethers . utils . hexZeroPad ( '0x01' , 32 ) ,
341+ ADDRESS_DEAD
342+ )
343+ ) . wait ( )
318344
319345 const customGatewayTemplate = await new L1CustomGateway__factory (
320346 l1Deployer
321347 ) . deploy ( )
322348 await customGatewayTemplate . deployed ( )
349+ await (
350+ await customGatewayTemplate . initialize (
351+ ADDRESS_DEAD ,
352+ ADDRESS_DEAD ,
353+ ADDRESS_DEAD ,
354+ ADDRESS_DEAD
355+ )
356+ ) . wait ( )
323357
324358 const wethGatewayTemplate = await new L1WethGateway__factory (
325359 l1Deployer
326360 ) . deploy ( )
327361 await wethGatewayTemplate . deployed ( )
362+ await (
363+ await wethGatewayTemplate . initialize (
364+ ADDRESS_DEAD ,
365+ ADDRESS_DEAD ,
366+ ADDRESS_DEAD ,
367+ ADDRESS_DEAD ,
368+ ADDRESS_DEAD
369+ )
370+ ) . wait ( )
328371
329372 const feeTokenBasedRouterTemplate = await new L1OrbitGatewayRouter__factory (
330373 l1Deployer
331374 ) . deploy ( )
332375 await feeTokenBasedRouterTemplate . deployed ( )
376+ await (
377+ await feeTokenBasedRouterTemplate . initialize (
378+ ADDRESS_DEAD ,
379+ ADDRESS_DEAD ,
380+ ADDRESS_DEAD ,
381+ ADDRESS_DEAD ,
382+ ADDRESS_DEAD
383+ )
384+ ) . wait ( )
333385
334386 const feeTokenBasedStandardGatewayTemplate =
335387 await new L1OrbitERC20Gateway__factory ( l1Deployer ) . deploy ( )
336388 await feeTokenBasedStandardGatewayTemplate . deployed ( )
389+ await (
390+ await feeTokenBasedStandardGatewayTemplate . initialize (
391+ ADDRESS_DEAD ,
392+ ADDRESS_DEAD ,
393+ ADDRESS_DEAD ,
394+ ethers . utils . hexZeroPad ( '0x01' , 32 ) ,
395+ ADDRESS_DEAD
396+ )
397+ ) . wait ( )
337398
338399 const feeTokenBasedCustomGatewayTemplate =
339400 await new L1OrbitCustomGateway__factory ( l1Deployer ) . deploy ( )
340401 await feeTokenBasedCustomGatewayTemplate . deployed ( )
402+ await (
403+ await feeTokenBasedCustomGatewayTemplate . initialize (
404+ ADDRESS_DEAD ,
405+ ADDRESS_DEAD ,
406+ ADDRESS_DEAD ,
407+ ADDRESS_DEAD
408+ )
409+ ) . wait ( )
341410
342411 const upgradeExecutorFactory = new ethers . ContractFactory (
343412 UpgradeExecutorABI ,
@@ -359,7 +428,7 @@ export const deployL1TokenBridgeCreator = async (
359428 upgradeExecutor : upgradeExecutor . address ,
360429 }
361430
362- /// deploy L2 contracts as placeholders on L1
431+ /// deploy L2 contracts as placeholders on L1. Initialize them with dummy data
363432 const l2TokenBridgeFactoryOnL1 =
364433 await new L2AtomicTokenBridgeFactory__factory ( l1Deployer ) . deploy ( )
365434 await l2TokenBridgeFactoryOnL1 . deployed ( )
@@ -368,21 +437,42 @@ export const deployL1TokenBridgeCreator = async (
368437 l1Deployer
369438 ) . deploy ( )
370439 await l2GatewayRouterOnL1 . deployed ( )
440+ await (
441+ await l2GatewayRouterOnL1 . initialize ( ADDRESS_DEAD , ADDRESS_DEAD )
442+ ) . wait ( )
371443
372444 const l2StandardGatewayAddressOnL1 = await new L2ERC20Gateway__factory (
373445 l1Deployer
374446 ) . deploy ( )
375447 await l2StandardGatewayAddressOnL1 . deployed ( )
448+ await (
449+ await l2StandardGatewayAddressOnL1 . initialize (
450+ ADDRESS_DEAD ,
451+ ADDRESS_DEAD ,
452+ ADDRESS_DEAD
453+ )
454+ ) . wait ( )
376455
377456 const l2CustomGatewayAddressOnL1 = await new L2CustomGateway__factory (
378457 l1Deployer
379458 ) . deploy ( )
380459 await l2CustomGatewayAddressOnL1 . deployed ( )
460+ await (
461+ await l2CustomGatewayAddressOnL1 . initialize ( ADDRESS_DEAD , ADDRESS_DEAD )
462+ ) . wait ( )
381463
382464 const l2WethGatewayAddressOnL1 = await new L2WethGateway__factory (
383465 l1Deployer
384466 ) . deploy ( )
385467 await l2WethGatewayAddressOnL1 . deployed ( )
468+ await (
469+ await l2WethGatewayAddressOnL1 . initialize (
470+ ADDRESS_DEAD ,
471+ ADDRESS_DEAD ,
472+ ADDRESS_DEAD ,
473+ ADDRESS_DEAD
474+ )
475+ ) . wait ( )
386476
387477 const l2WethAddressOnL1 = await new AeWETH__factory ( l1Deployer ) . deploy ( )
388478 await l2WethAddressOnL1 . deployed ( )
0 commit comments