@@ -43,6 +43,8 @@ import {TransparentUpgradeableProxy} from
4343 "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol " ;
4444import {IAccessControlUpgradeable} from
4545 "@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol " ;
46+ import {MasterVaultFactory} from "../libraries/vault/MasterVaultFactory.sol " ;
47+ import {L1ArbitrumGateway} from "./gateway/L1ArbitrumGateway.sol " ;
4648
4749/**
4850 * @title Layer1 token bridge creator
@@ -80,6 +82,12 @@ contract L1AtomicTokenBridgeCreator is Initializable, OwnableUpgradeable {
8082 L1OrbitERC20Gateway feeTokenBasedStandardGatewayTemplate;
8183 L1OrbitCustomGateway feeTokenBasedCustomGatewayTemplate;
8284 IUpgradeExecutor upgradeExecutor;
85+ MasterVaultFactory masterVaultFactory;
86+ }
87+
88+ struct YieldBearingGatewayConfig {
89+ bool enableYieldBearing;
90+ address underlyingToken;
8391 }
8492
8593 // use separate mapping to allow appending to the struct in the future
@@ -195,6 +203,27 @@ contract L1AtomicTokenBridgeCreator is Initializable, OwnableUpgradeable {
195203 uint256 maxGasForContracts ,
196204 uint256 gasPriceBid
197205 ) external payable {
206+ YieldBearingGatewayConfig memory emptyConfig;
207+ _createTokenBridge (inbox, rollupOwner, maxGasForContracts, gasPriceBid, emptyConfig);
208+ }
209+
210+ function createTokenBridge (
211+ address inbox ,
212+ address rollupOwner ,
213+ uint256 maxGasForContracts ,
214+ uint256 gasPriceBid ,
215+ YieldBearingGatewayConfig memory yieldBearingConfig
216+ ) external payable {
217+ _createTokenBridge (inbox, rollupOwner, maxGasForContracts, gasPriceBid, yieldBearingConfig);
218+ }
219+
220+ function _createTokenBridge (
221+ address inbox ,
222+ address rollupOwner ,
223+ uint256 maxGasForContracts ,
224+ uint256 gasPriceBid ,
225+ YieldBearingGatewayConfig memory yieldBearingConfig
226+ ) internal {
198227 // templates have to be in place
199228 if (address (l1Templates.routerTemplate) == address (0 )) {
200229 revert L1AtomicTokenBridgeCreator_TemplatesNotSet ();
@@ -277,13 +306,33 @@ contract L1AtomicTokenBridgeCreator is Initializable, OwnableUpgradeable {
277306 )
278307 );
279308
280- standardGateway.initialize (
281- l2Deployment.standardGateway,
282- l1Deployment.router,
283- inbox,
284- keccak256 (type (ClonableBeaconProxy).creationCode),
285- l2Deployment.beaconProxyFactory
286- );
309+ if (
310+ yieldBearingConfig.enableYieldBearing &&
311+ yieldBearingConfig.underlyingToken != address (0 )
312+ ) {
313+ L1ArbitrumGateway.YieldBearingConfig memory config = L1ArbitrumGateway
314+ .YieldBearingConfig ({
315+ token: yieldBearingConfig.underlyingToken,
316+ masterVaultFactory: address (l1Templates.masterVaultFactory),
317+ isYieldBearingGateway: true
318+ });
319+ standardGateway.initialize (
320+ l2Deployment.standardGateway,
321+ l1Deployment.router,
322+ inbox,
323+ keccak256 (type (ClonableBeaconProxy).creationCode),
324+ l2Deployment.beaconProxyFactory,
325+ config
326+ );
327+ } else {
328+ standardGateway.initialize (
329+ l2Deployment.standardGateway,
330+ l1Deployment.router,
331+ inbox,
332+ keccak256 (type (ClonableBeaconProxy).creationCode),
333+ l2Deployment.beaconProxyFactory
334+ );
335+ }
287336
288337 l1Deployment.standardGateway = address (standardGateway);
289338 }
@@ -300,9 +349,31 @@ contract L1AtomicTokenBridgeCreator is Initializable, OwnableUpgradeable {
300349 )
301350 );
302351
303- customGateway.initialize (
304- l2Deployment.customGateway, l1Deployment.router, inbox, upgradeExecutor
305- );
352+ if (
353+ yieldBearingConfig.enableYieldBearing &&
354+ yieldBearingConfig.underlyingToken != address (0 )
355+ ) {
356+ L1ArbitrumGateway.YieldBearingConfig memory config = L1ArbitrumGateway
357+ .YieldBearingConfig ({
358+ token: yieldBearingConfig.underlyingToken,
359+ masterVaultFactory: address (l1Templates.masterVaultFactory),
360+ isYieldBearingGateway: true
361+ });
362+ customGateway.initialize (
363+ l2Deployment.customGateway,
364+ l1Deployment.router,
365+ inbox,
366+ upgradeExecutor,
367+ config
368+ );
369+ } else {
370+ customGateway.initialize (
371+ l2Deployment.customGateway,
372+ l1Deployment.router,
373+ inbox,
374+ upgradeExecutor
375+ );
376+ }
306377
307378 l1Deployment.customGateway = address (customGateway);
308379 }
0 commit comments