@@ -65,17 +65,22 @@ contract BridgeCreator is Ownable {
6565 }
6666
6767 function _createBridge (
68+ bytes32 create2Salt ,
6869 address adminProxy ,
6970 BridgeTemplates memory templates ,
7071 bool isDelayBufferable
7172 ) internal returns (BridgeContracts memory ) {
7273 BridgeContracts memory frame;
7374 frame.bridge = IBridge (
74- address (new TransparentUpgradeableProxy (address (templates.bridge), adminProxy, "" ))
75+ address (
76+ new TransparentUpgradeableProxy {salt: create2Salt}(
77+ address (templates.bridge), adminProxy, ""
78+ )
79+ )
7580 );
7681 frame.sequencerInbox = ISequencerInbox (
7782 address (
78- new TransparentUpgradeableProxy (
83+ new TransparentUpgradeableProxy {salt: create2Salt} (
7984 address (
8085 isDelayBufferable
8186 ? templates.delayBufferableSequencerInbox
@@ -87,15 +92,25 @@ contract BridgeCreator is Ownable {
8792 )
8893 );
8994 frame.inbox = IInboxBase (
90- address (new TransparentUpgradeableProxy (address (templates.inbox), adminProxy, "" ))
95+ address (
96+ new TransparentUpgradeableProxy {salt: create2Salt}(
97+ address (templates.inbox), adminProxy, ""
98+ )
99+ )
91100 );
92101 frame.rollupEventInbox = IRollupEventInbox (
93102 address (
94- new TransparentUpgradeableProxy (address (templates.rollupEventInbox), adminProxy, "" )
103+ new TransparentUpgradeableProxy {salt: create2Salt}(
104+ address (templates.rollupEventInbox), adminProxy, ""
105+ )
95106 )
96107 );
97108 frame.outbox = IOutbox (
98- address (new TransparentUpgradeableProxy (address (templates.outbox), adminProxy, "" ))
109+ address (
110+ new TransparentUpgradeableProxy {salt: create2Salt}(
111+ address (templates.outbox), adminProxy, ""
112+ )
113+ )
99114 );
100115 return frame;
101116 }
@@ -107,11 +122,14 @@ contract BridgeCreator is Ownable {
107122 ISequencerInbox.MaxTimeVariation calldata maxTimeVariation ,
108123 BufferConfig calldata bufferConfig
109124 ) external returns (BridgeContracts memory ) {
125+ // use create2 salt to ensure deterministic addresses
126+ bytes32 create2Salt = keccak256 (abi.encode (msg .data , msg .sender ));
110127 // create delay bufferable sequencer inbox if threshold is non-zero
111128 bool isDelayBufferable = bufferConfig.threshold != 0 ;
112129
113130 // create ETH-based bridge if address zero is provided for native token, otherwise create ERC20-based bridge
114131 BridgeContracts memory frame = _createBridge (
132+ create2Salt,
115133 adminProxy,
116134 nativeToken == address (0 ) ? ethBasedTemplates : erc20BasedTemplates,
117135 isDelayBufferable
0 commit comments